3 ms·
Nice examples. Feedback for the author if they see this thread: 1) \S can be used instead of [^\s]. I haven't come across a regex flavor that supports \s but n
by asicsp 6y ago
Nice examples. Feedback for the author if they see this thread:
1) \S can be used instead of [^\s]. I haven't come across a regex flavor that supports \s but not \S. GNU grep supports \s and \S but doesn't support using them inside character classes.
2) For the first example, it is a weird mix of formatting for the code snippets. Rest of the examples are properly code formatted and specified without single quotes around the expression.
3) The fourth example uses variable length lookbehind, which isn't supported by Perl, Python (unless you use regex module), Ruby, etc. \K can be used instead if supported. Also, `<` at the start of the regex is a typo
- bmn__ 6y ago> variable length lookbehind, which isn't supported by Perl It is supported: https://perldoc.perl.org/perl5300delta#Core-Enhancements https://perldoc.perl.org/perl5300delta#Core-Enhancements Work-around for all previous versions: http://www.drregex.com/2019/02/variable-length-lookbehinds-actually.html http://www.drregex.com/2019/02/variable-length-lookbehinds-a...
- asicsp 6y agoGood to know that support is being worked upon. Seems limited as of now, this is what I get on v5.32: $ echo 'asb34 asgfdhgree56 jdf42' | perl -lne 'print join "\n", /(?<=\ba[a-z]*)\d+/g' Lookbehind longer than 255 not implemented in regex m/(?<=\ba[a-z]*)\d+/ at -e line 1.