Skip to content

Instantly share code, notes, and snippets.

@gatamar
Created April 9, 2019 18:04
Show Gist options
  • Save gatamar/a0b6cbac1e901aae73103f679b24ea90 to your computer and use it in GitHub Desktop.
Save gatamar/a0b6cbac1e901aae73103f679b24ea90 to your computer and use it in GitHub Desktop.
import regex
def try_recursive_regex():
text = "ababagalamaga1-ababagalamaga2-(werewr(o)(l)(i)(a))sdfsdf()()(((("
pattern = "\((?>[^()]|(?R))*\)"
res = regex.findall(pattern, text)
print( res )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment