Since many people are not good at them, whenever I use a regex in code, I add a comment with at least one example of the text that is to be matched, and note what the regex is also attempting to avoid. This is also a learning activity.
There is also the "Mastering Regular Expressions" book.
I used to work at a Perl shop. The language makes it so easy to use regexes that you risk abusing them, but nevertheless that exposure has helped me become quite proficient with regexes. I use Perl one liners whenever I need to deal with text data on the command line, so that keeps me exposed to regexes.
I don't really understand the question. Writing regexes seems fairly straight-forward to me, as in I just do the first thing I think of most of the time.
This makes me think I'm in the 'not good at regexes' group. The most advanced things I use are multiline, non-capturing, non-greedy modifiers and back-references in the pattern or replacement. If it goes beyond that I parse.
Anyone mind posting some more advanced usages that come up?
3 comments
[ 5.0 ms ] story [ 21.2 ms ] threadSince many people are not good at them, whenever I use a regex in code, I add a comment with at least one example of the text that is to be matched, and note what the regex is also attempting to avoid. This is also a learning activity.
There is also the "Mastering Regular Expressions" book.
This makes me think I'm in the 'not good at regexes' group. The most advanced things I use are multiline, non-capturing, non-greedy modifiers and back-references in the pattern or replacement. If it goes beyond that I parse.
Anyone mind posting some more advanced usages that come up?