3 ms·
The regular expression example makes no sense for me. A regexp is a very specialized way of express what a pattern must match, opossed to a java code that expre
by samuel 17y ago
The regular expression example makes no sense for me. A regexp is a very specialized way of express what a pattern must match, opossed to a java code that express how to perform the matching.
You don't regexp's compact syntax. That's fine. You would have a point if you say that its more readable, let's say:
1: EXACT <a>(3)
3: PLUS(15)
4: ANYOF[ab](0)
15: OPEN1(17)
17: EXACT <cd>(19)
19: CURLY {0,1}(23)
21: EXACT <s>(0)
23: CLOSE1(25)
25: END(0)
than
/a[ab]+(cds?)/
but it's much easier to introduce a bug in 20 lines of Java code that deals with an ad-hoc parsing than in a regexp, specially if you have to change the pattern.