Skip to content

Conversation

@jgrey4296
Copy link

This adds basic support for whitespace patterns by altering how regex's are compiled, no longer escaping + and * symbols.
To handle this when rewriting lines, a replacement_pattern is added to Pattern, allowing a pre-formatted version string to be subbed into the matching line directly. This means no changes are made to _format_segment.

A couple of tests are added to show it working, and test_v1_error_bad_pattern breaks... but I have no idea why because I didn't touch v1 pattern code.

@mbarkhau
Copy link
Owner

HI @jgrey4296,

sorry I didn't take the time to review this earlier. In principle I think this is going in the right direction, but we need to make sure to not break any existing configurations.

I would suggest that we introduce a config variable auto_escape = true, where the default is true and if you want to include regex syntax in your version pattern, you need to set it to auto_escape = false.

It might then be appropriate, to skip all of RE_PATTERN_ESCAPES, and not just the ones you commented out.

What do you think?

@jgrey4296
Copy link
Author

no worries, and yeah that makes sense. I'll get on that :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants