3 ms·
I've gotten into the habit of using the "not" operation instead of .* a lot. If I'm looking for bracketed text, I use not-bracket to match the contents. I ten
by Pxtl 12y ago
I've gotten into the habit of using the "not" operation instead of .* a lot. If I'm looking for bracketed text, I use not-bracket to match the contents.
I tend to avoid the non-greedy operator just because it often fails in terrible half-assed regex implementations (eg. visual studio 2010)
- bane 12y agoI wish the not operator allowed for sub-expressions instead of just character classes. It'll probably make it slower, but it would remove lots of unreadable convolutions people have to go through.
- ori_b 12y agoThere are some regex implementations that allow it, but it's a very confusing feature. Remember that '' is not 'a'. Arbitrary expressions can have arbitrary length, so excluding an expression simply will match it, fail the match, and backtrack to the next option.
- blueblob 12y agoMe too. I find that if you work in a bunch of different languages it seems more portable (and one less thing to remember). It also seems easier to debug.