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

Reply via email to