----- Original Message -----
From: "Andy Jennings" <[EMAIL PROTECTED]>
To: "jose quesada" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Saturday, April 07, 2001 11:43 PM
Subject: Re: how to represent "any character" (incl. \n) in regexp?


> Jose
>
> While this will work for Bennet in this particular, very specific, case,
/s
> also has some other side effects which if not considered can lead to
> problems later down the road if you get a false sense of security with it.
> In particular it will match groups of identical characters like
> 'aaaaaaaaaaaaaaaaaaaaaa' which will almost certainly be a bad thing in
most
> other cases - for instance, where you want the regex to look for very
> specific chars around a newline.
>
> $*. was deprecated for a good reason and I think /s purely as a means to
> match newlines will become deprecated in the same way.
>
> Just my two cents worth.....
>
> Andy
>
> ----- Original Message -----
> From: "jose quesada" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, April 07, 2001 11:06 PM
> Subject: Re: how to represent "any character" (incl. \n) in regexp?
>
>
> >
> >
> >
> >
> > Bennett Haselton wrote:
> >
> > > Since according to p. 25 of "Programming Perl" by Wall, "." stands for
> "any
> > > character except newline" and "\n" stands for "newline", and [<set>]
> > > matches "any character in <set>", I thought you could use "[.\n]" to
> match
> > > "any character":
> > >
> >
> > You could use the /s modificator (in substitutions, like
> > s/bla(.)/blo$1/s; in
> > matching, m/bla./s ) (camel book, p. 153).
> > Or you can use the deprecated $*. (Not recommended).
> >
> > TIMTOWTDI,
> >
> > Cheers,
> >
> > Jose
> >
> >
> >
> > >
> > > >>>
> > > $string = 'abc';
> > > if ($string =~ /([.\n])/)
> > > {
> > >         print "yes: $1\n";
> > > }
> > > else
> > > {
> > >         print "no\n";
> > > }
> > > >>>
> > >
> > > But this prints out "no".  It turns out that inside the square
brackets,
> > > "." represents the period character and not "any character"; if you
> change
> > > string to "a.bc", the script print "yes: ." .  In that case, how do
you
> > > represent "any character" inside a regexp?
> > >
> > >         -Bennett
> > >
> > > [EMAIL PROTECTED]     http://www.peacefire.org
> > > (425) 649 9024
> > > _______________________________________________
> > > Perl-Win32-Users mailing list
> > > [EMAIL PROTECTED]
> > > http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
> >
> > --
> > Jose Quesada Jimenez
> >
> > [EMAIL PROTECTED]             Research associate
> > http://lsa.colorado.edu/~quesadaj       Institute of Cognitive Science
> > http://geneura.ugr.es/~jose             University of Colorado (Boulder)
> >
> > Muenzinger psychology building          Phone,  work:303 492 1522
> > office D447A
> > Campus Box 344                                  home:303 545 2082
> > University of Colorado at Boulder
> > Boulder, CO 80309-0344
> > _______________________________________________
> > Perl-Win32-Users mailing list
> > [EMAIL PROTECTED]
> > http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
> >
> >
>


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to