This and other RFCs are available on the web at
  http://dev.perl.org/rfc/

=head1  TITLE

Additions to regexs

=head1 VERSION

        Maintainer: Richard Proctor <[EMAIL PROTECTED]>
        Date: 27 Aug 2000
        Mailing List: [EMAIL PROTECTED]
        Version: 1
        Number: 166

=head1 ABSTRACT

This is a set of minor enhancements to regexs that I thought up on a long
plane ride.  All these can be done now, I would just like to make them
easier.

=head1 DESCRIPTION

These are a set of minor enhancements to regexes, they are largely independant.

=head2 Alternative Lists from arrays

(?@foo) is sort of equivalent to (??{join('|',@foo)}), ie it expands into a
list of alternatives.  One could possible use just @foo, for this.

If @foo contained special characters you might want to \Quote each item.

(?Q@foo) is sort of equivalent to (??{join('|', map quotemeta, @foo)})

=head2 Matching Not a pattern

(?^pattern) matches anything that does not match the pattern.  On its own, one
can use !~ etc to negatively match patterns, but to match a pattern that 
has foo(anything but not baz)bar is currently difficult.  With this syntax
it would simply be /foo(?^baz)bar/.

=head2 A disambiguator

(?) is a null element in a pattern, that can be used to split elements that
might otherwise be confused, it has no effect otherwise, it matches nothing. 
If you have a variable $foo, then matching $foobar would look for the
variable $foobar, when you actually meant to look for $foo then "bar".  This
allows the user to simply write $foo(?)bar.  (Yes I know this can be written
other ways but this is a simple example).

=head1 IMPLENTATION

No Idea

=head1 REFERENCES

None yet

Reply via email to