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.)?

2. I've heard that 'parse actually supports a superset of regular
expressions. Is this true?

3. If there are no plans to build regular expressions into the language,
would anyone be interested if someone were to develop a regular expression
capability?

4. If there is interest, what are your thoughts on it? How would it work,
look, etc?

maybe there could be a 'regex word, or possibly have it as a refinement to
'parse, as in parse/regex. (Is it even possible to add a refinement to a
native word?)

a skeleton of 'regex might look like this:

regex: make function! [
    string [string!] "The string to run the regex on"
    pattern [string! block!] "The regular expression pattern"
]
[
    ;do matching
]

'regex could return a block of values for patterns that have parentheses in
them, so with

string: "Hello, World. This is your captain speaking."
regex string "(H.+),.+(c.+) "

regex returns ["Hello" "captain"]

Maybe the 'regex could work purely by translating regular expressions into
parse dialects and use 'parse internally? (that is, if parse contains
everything necessary to do this).

Anyway, these are just some quick sketches. Does anyone think it would be
worth it were someone to develop it? Would it be so slow that it would be
useless? Does anyone have any other thoughts they want to share?

Also, quick question about 'parse... does 'parse ever return a true value
for anything other than simple splitting?

Thanks everyone.

Keith

Reply via email to