Re:The New ‘Absent Operator’ in Ruby’s Regular Expressions
by daenney on Thursday March 23, 2017 @10:07AM
(#13939824)
It seems this has a high potential for bugs though if people aren't aware of that detail with the `coffee and tv` example. Depending on how well versed you are with regexes it isn't immediately obvious.
[ Parent
| on HN ]
Re:The New ‘Absent Operator’ in Ruby’s Regular Expressions
by mst on Thursday March 23, 2017 @12:09PM
(#13941054)
Honestly, that's true of lots of unanchored constructs - which is why I tend to try and teach people to always /^...$/ or /\A...\Z/ depending on context.
Re:The New ‘Absent Operator’ in Ruby’s Regular Expressions
by petercooper on Thursday March 23, 2017 @10:22AM
(#13939957)
Yes, when I was initially investigating it, it tripped me up which is why I wanted to make a point of it.
I know a lot of people on HN have far more experience with regexes at a theoretical level than me, so I'm also hoping any errors are quickly highlighted in comments here for me to correct :-D