-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for user controlled or raw regular expression #45
Comments
I'd prefer flags being supported by default. I believe it would be enough to just use newish |
The offending I don't see cases where the |
Notice that although inline flags were supposed to be used in the beginning if the pattern, they were actually supported also elsewhere until Python 3.11. For example, |
I'm a bit out of my comfort zone and knowledge expertise when it comes to re design and architecture. The one thing I did really like and wanted to keep was that for regular expression one could just write the full expected message and not have to write out the match start and end. So if fullmatch works like that, which I was assuming it did, then I am good with your suggestions. |
The current implementation of the
REGEX:
match automatically prepend with^
and postpend$
matching the entire message. This default is good because it reads without needing these symbols. But in some case when we want to use an inline modifier or flag then this throws an exception under Python 3.11 or greater. (Might be an earlier version but my search show this to have changed from a warning to an error with 3.11). Reason is that inline modifiers must be at the beginning of the expression. But with the behind the scenes addition of^
. this prevents this from happening withREGEX:
.To resolve while still keeping the existing usage I was proposing a new match called
RAWRE
(orRAWREGX
orRAWREGEX
or the like), for "raw regular expression", which will not include the prepended ^ and postpended $.Attached is a sample test demonstrating the problem and a proposed solution. In addition to removing the prepend and postpended flags I also removed the re.DOTALL flag allowing the user to use rawre to use whichever flags they choose.
leading_global_flag_error.patch
raw_re_solution.patch
test_solution.patch
The text was updated successfully, but these errors were encountered: