in reply to regular expression-xerox

You seem to have already figured out that [ABCD] is semi-equivalent to (A|B|C|D). What do you need help with?

It is more properly equivalent to (?:A|B|C|D). The difference is that (?: ... ) is strictly for grouping and alternation while ( ... ) also captures its contents into a variable that can be accessed with a number like $1, $2, $3, etc.

Replies are listed 'Best First'.
Re: Re: regular expression-xerox
by oz (Novice) on May 04, 2004 at 09:59 UTC
    Because I need to translate it in another regular expression format.

      I fail to see the problem. What part of the problem involving writing [ABCD] as (A|B|C|D) escapes you?

        It doesn't escape. I am gonna used that in a different sytem whose regular expressions are defined differently. I am trying to make the translation between that system and the user by perl.