> > I think that Regexps are hard to learn because the most part of the folks > > that aren't too much scared to learn it just lack the essential and > > unavoidable compiler theory where regexp lays its foundations. IMHO, its > > simply impossible learn good quality regexp use unless you have good regular > > grammars theory before. > > No, that's WRONG. Again, I can only give myself as an example, but, I > had no compiler theory or regular grammars theory. Regular expressions > MAKE SENSE - in (again) my humble experience, it tends to be people who > started with C or somesuch language who have the most difficulty with > them. Go figure.
I agree that regexps seem to 'click' quite rapidly with some people, and simply remain opaque for a long time with other people. I'm not sure why this is. The owl book is excellent, but it also tends to make people think "These regexps are really powerful, but really complex - I'll live without them". I currently spend a lot of time trying to get Java programmers to use more regexps. They all love the power and ability they have, but find them hard to debug and so tend not to use them, or get frustrated easily. Java's poor implementation* doesn't help. However, I disagree that you need to understand the magic bahind regexps to use them. The main strengths of regexps, esp. in their Perl implementation is easy of use: if($userinput eq 'y') ## yucky { ... } if($userinput =~ /^\s*y|(ok)/i) # nice { ... } Later, the expert user can start to learn more about how the engine works, in order to craft more complex regexps. *Using the various add on libraries for Java 1.2, which are either feature poor (apache) or just really annoying in a stupid java-y way(gnu).