4 ms·
"Pire does not have any Perlish conditional regexps, lookaheads & backtrackings, greedy/nongreedy matches; neither has it any capturing facilities." Well that
by jdludlow 16y ago
"Pire does not have any Perlish conditional
regexps, lookaheads & backtrackings, greedy/nongreedy matches; neither has it any capturing facilities."
Well that rules out nearly every use case I have for needing a regex in the first place.
- bartl 16y agoProbably the only use case I can think of, is for "does it match?" tests. Spam detection, like SpamAssassin, might benefit from it.
- nowarninglabel 16y agoIf that is the case, wouldn't we just use more specialized functions, I forget the boost_regex function for C++, but for PHP we can do strpos() instead strstr() to see simply if a string exists? In that case, I'm guessing the benchmarks would be closer.
- xentronium 16y agoSubstring location won't tell you if your string is an email, for example.
- nowarninglabel 16y agoYes, good point.
- jonhohle 16y agoNeither will a regex [1] [1] http://www.regular-expressions.info/email.html http://www.regular-expressions.info/email.html
- iloveponies 16y agoThat totally depends on the regex: http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html
- jonhohle 16y agoFrom the page you linked: > This regular expression will only validate addresses that have had any comments stripped and replaced with whitespace (this is done by the module). There is filtering done before the regex is applied.
- Groxx 16y agoGreedy / non-greedy is one of the main things I use in regexes (well, second to capturing). That sucks. Though if it's non-capturing, I guess it makes sense. How many people do use regexes for boolean operations? I can only think of an instance or two where I have, aside from regular input validation.
- jemfinch 16y agoMost uses of non-greedy matching can be replaced with faster, clearer, and more precise inverted character classes, in my experience.
- amalcon 16y agoI was actually building something very similar to this, though I stopped about six months ago due to time constraints. The goal was to be able to check which of a set of regular expressions matches a given string, and then invoke PCRE or similar to get the subexpression capture. The end result: Django-style regex URL routing against an arbitrary number of expressions, in the same amount of time as routing against a single expression. Of course, I generally never use any of those features except the capture. (And greedy/nongreedy matching, but that is irrelevant if you're not doing a subexpression capture)
- sophacles 16y agoWhen dealing with very very large datasets, the ability to filter fast is important. So it becomes a 2-stage (actually n-stage...) problem: filter the raw data, and remove the parts that are known irrelevant (alternately include only the 'maybes'), then do the more intensive processing on the smaller resultant data-set. When done in parallel it looks a lot like map-reduce :)