Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
the code worked fine with just one (\s) whitespace character between number and "to" but with the (.+) it truncates the variable or something. Please help me monks, thanks in advance. Jono#!/usr/bin/perl while(<>){ print if m!(\d+)to(\d+)!i; print "$1\n"; print "$2\n"; } but when i add (.+) the variables ($1, $2) aren't diplayed the same: #!/usr/bin/perl while(<>){ print if m!(\d+).+to.+(\d+)!i; print "$1\n"; print "$2\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: $1 and regex
by dws (Chancellor) on Aug 27, 2002 at 07:39 UTC | |
by sauoq (Abbot) on Aug 27, 2002 at 18:23 UTC | |
by dws (Chancellor) on Aug 27, 2002 at 18:28 UTC | |
by sauoq (Abbot) on Aug 27, 2002 at 19:44 UTC | |
by dws (Chancellor) on Aug 27, 2002 at 19:53 UTC | |
by Arien (Pilgrim) on Aug 27, 2002 at 18:56 UTC | |
|
Re: $1 and regex
by tmiklas (Hermit) on Aug 27, 2002 at 07:22 UTC | |
|
Re: $1 and regex
by Django (Pilgrim) on Aug 27, 2002 at 07:25 UTC | |
|
Re: $1 and regex
by jmcnamara (Monsignor) on Aug 27, 2002 at 07:31 UTC | |
by tlhf (Scribe) on Aug 28, 2002 at 02:07 UTC | |
|
Re: $1 and regex
by hotshot (Prior) on Aug 27, 2002 at 07:23 UTC | |
|
Re: $1 and regex
by NaSe77 (Monk) on Aug 27, 2002 at 07:27 UTC |