[REBOL] 5 simple pattern matching questions Re:
From: d95-mjo:nada:kth:se at: 15-Sep-2000 10:48
On Fri, 15 Sep 2000 [princepawn--MailAndNews--com] wrote:
> I am having problems switching my understanding of regular expressions to the
> REBOL parse dialect. Could someone please tell me how to do each of the
> following with parse?
>
> 5. match any char: I think this is done by creating a bitset from a charset
> from hex 000 to hex 255 and parsing on that, but it doesnt work, e.g.,
> bset: charset [ #"^(00)" - #"^(FF)" ]
> parse " " [ some bset ]
>
> fails
The problem here is that if you don't use parse/all, the space is
ignored.
>> help parse
USAGE:
PARSE input rules /all /case
...
...
REFINEMENTS:
/all -- Parses all chars including spaces.
...
...
Try this:
bset: charset [ #"^(00)" - #"^(FF)" ]
parse/all " " [ some bset ]
Or if you don't want to have to type all those weird chars:
bset: complement charset ""
parse/all " " [ some bset ]
/Martin Johannesson, [d95-mjo--nada--kth--se]