Hacker News new | ask | show | jobs
by suivix 5315 days ago
The (?i) is a confusing part of that example expression, and I don't see why it's necessary.
3 comments

The (? ... ) syntax is for "extended patterns". In this case, it makes the rest of the regular expression case insensitive. Read through http://perldoc.perl.org/perlre.html#Extended-Patterns for more information on extended patterns.
It's good to know about it. Earlier at an employer we had a system where a processor in the pipeline took regular expressions as input - you can pass regular expressions but not the flags. (?i) is the only way you can indicate case-insensitive in these cases.
Which one? That might be an error.
I think it's the one on the "cover page" (the one linked to from HN.