Hi Keith,

>Hi, just wondering about regular expressions in Rebol.
>
>1. Is there any support for regular expressions planned (or is Rebol only
>going to support 'parse for everything regular expressions might be used for
>that isn't already taken care of by words like 'find.)?

Funny you should ask. I just posted search-text.r to rebol.org, which is an
attempt to simulate regular expressions in REBOL. Please have a look at it
and tell me what you think.

http://www.rebol.org/utility/search-text.r

I could go on all day about how regular expressions are similar and
dissimilar to parse rules, but I believe you can accomplish anything with a
parse rule that you can with a regex, only it can be a real pain in the butt.

Regexes have automatic backtracking - a regex engine will try any possible
combination of the elements you specify to make a match. Parse rules don't do
that - parse'll just plow through your rule unless you explicitly say, "and
if that didn't work back up to this point and try this." Parse rules are
great when you've got structured data meant to be read by a computer, since
regexes can find devilish ways to match things that shouldn't match.  Regexes
are better and much more concise when you're just looking for combinations of
words in natural languages.

See you around,
Eric

Reply via email to