Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: Embperl
About the regular expression problem
 

Index | Next | Previous | View Flat


yurenli at gmail

May 4, 2007, 12:51 AM


Views: 1207
Permalink
About the regular expression problem

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 [at] perl
For additional commands, e-mail: embperl-help [at] perl

Subject User Time
About the regular expression problem yurenli at gmail May 4, 2007, 12:51 AM
    RE: About the regular expression problem richter at ecos May 4, 2007, 4:14 AM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.