Grouping¶
.group¶
Creates a non-capturing group of the proceeding elements. Needs to be finalised with .end()
.
Example
ExpressiveRegex()\
.group\
.range('a', 'f')\
.range('0', '9')\
.string('XXX')\
.end()\
.toRegexString()
([a-f][0-9]XXX)
.capture¶
Creates a capture group for the proceeding elements. Needs to be finalised with .end()
.
Example
ExpressiveRegex()\
.capture\
.range('a', 'f')\
.range('0', '9')\
.string('XXX')\
.end()\
.toRegexString()
([a-f][0-9]XXX)
.setOfLiterals¶
Creates a set from the proceeding elements. Needs to be finalised with .end()
.
Inside this statement only is allowed Literals except
anyChar, .rawChar,
.string, .rawString,
.anythingButRange,
.anythingButChars
Example
ExpressiveRegex()\
.setOfLiterals\
.char('-')\
.range(1,4)\
.anyOfChars('dfs')\
.end()\
.toRegexString()
"[\-1-4dfs]"
.end()¶
Signifies the end of a ExpressiveRegex grouping.
Example
ExpressiveRegex()
.capture\
.setOfLiterals\
.char('-')\
.range(1,4)\
.anyOfChars('dfs')\
.end()\
.range('0', '9')\
.string('XXX')\
.end()\
.toRegexString()
([\-1-4dfs][0-9]XXX)