The true power of regular expression
11–20 of 20 posts
Re: The true power of regular expression
#12the examples won't work in python or java, for example.
Re: The true power of regular expression
#13So...on the off-chance that the default SDKs for Java / .Net do not implement this natively, anyone have a link to some (preferably free) libraries that do make use of this implementation?
http://www.pcre.org/
Re: The true power of regular expression
#14Earlier quoted context omitted.
http://www.pcre.org/
How Perl-compatible is pcre nowadays? Does it implement all the regular expression features in Perl?
Re: The true power of regular expression
#15The main point against using regular expression for me is that it takes developers that are new to the code (or yourself in a few months) so long to figure out what is happening there, not that they are not powerful. The fact that there is no way to debug them in most environments and no comments does not help.
As far as no comments or not being able to debug, you can place each regex in a clearly named variable. And for debugging, there are a wealth of external tools out there, and in Java you certainly can step through them in a debugger (if you like pain). Like code, there are ways to write regex that are more readable and maintainable than others. We should make our regexes clear and used in conjunction with well thought out code. Then the software is a joy to work with, after spending 2 days studying regular-expressions.info.
Re: The true power of regular expression
#16From the manual:
The theoretical computer scientists out there will correctly point out that a self-referential regular expression is not "regular", so in the strict sense, xpressive isn't really a regular expression engine at all. But as Larry Wall once said, "the term [regular expression] has grown with the capabilities of our pattern matching engines, so I'm not going to try to fight linguistic necessity here."
Re: The true power of regular expression
#17in case it's not clear - the "regular expressions" he's using are perl's (well, based on perl's - PCRE) which are notoriously extended past the theoretical definition, or past what almost all other regexp libs / languages provide. the examples won't work in python or java, for example.
Re: The true power of regular expression
#18Re: The true power of regular expression
#19Once I read an article where the autor recomended using "regular expression" meaning the formal theory and "regex" to point out the (more powerfull) implementation. I think it's a good way to provide a common vocabulary.
Re: The true power of regular expression
#20> Context-sensitive languages are something that you will rarely encounter during “normal” programming.
In my experience, context-sensitive languages, as a class, are never encountered in programming. Certainly, one might need to deal with a formal language that happens to be context-sensitive but not context-free; however, the fact that it lies in the context-sensitive class does not ever seem to be a useful fact.
The concepts of regular, context-free, and recursively-enumerable languages are obviously useful ones for us. But I think the only reason programmers ever mention the class of context-sensitive languages is that they feel obligated to, having mentioned the other three classes in Chomsky's hierarchy.
If anyone knows of an instance where the fact the concept of context-sensitive languages/grammars was useful in a computational context[1], I'd like to hear about it.
[1] Heck, any context. Are context-sensitive grammars really useful in the study of natural languages? I wouldn't be surprised if the answer turns out to be "no".