|
![](/i/fill.gif) |
On 16/07/2012 12:48 PM, Warp wrote:
> You can argue against regexes by giving examples of really long and
> complicated patterns, but then you would be complaining about extreme
> fringe cases, not about *the most common* usage for them, for which they
> are just superb.
In my limited experience, people don't use regexes for simple pattern
matches. They only use them for insanely complex cases - cases where it
would be far, far better to spell out exactly what you're trying to do,
rather than encode it into a tangle of punctuation.
I can see how if you're just trying to quickly search some document for
a piece of information, being able to throw together a short text string
and get nearly the right results might be useful. And hey, if you're
only doing this once, who /cares/ that it's completely non-maintainable.
It's a one-off task; you don't /need/ to maintain anything.
But for building large, complex applications, regexes seem like a
stupendously bad idea.
Also, the usual formulation of regexes as text strings means that you
can only match against text strings. Admittedly that's the most common
case for wanting to do complicated matching. But if, say, you wanted to
match against a binary file... sorry, you can't do that. As far as I can
tell, there's no reason why a formal regular expression can't be matched
against binary data; it's just that most real-world implementations
don't allow this.
Post a reply to this message
|
![](/i/fill.gif) |