3 ms·
If 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()
by nowarninglabel 16y ago
If 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.