perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yuren Li" <yure...@gmail.com>
Subject About the regular expression problem
Date Fri, 04 May 2007 07:51:49 GMT
Hi,
I have a problem when I use regular expression.
The sample code:
[- $_ = "One Two Three" -]
[$ if(/(\S+) (\S+) (\S+)/) $]
The words are: [+$1+], [+$2+], [+$3+]
[$ endif $]

The result should be "The words are: One, Two, Three," But I got the
result "The words are: One, Two,."
After trying, I found that I could just get the match variables $1 and
$2, and the match veriables $3, $4 etc, could not be used in embperl.

There is no problem about this in pure perl code such as
$_ = "One Two Three";
if(/(\S+) (\S+) (\S+)/) {
    printf "The words are: $1, $2, $3";
}

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message