Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl while (<>) { print if m!(-?\d*?.?\d+)to(-?\d*?.?\d+)!m; print "$1\n$2\n"; print "$_\n" for ($1 .. $2); } giving the result: [barry@localhost]$ ./g 4.5to6.8 4.5to6.8 4.5 6 4 5 6 the "4.5" extracts properly but not the "6.8", it gets truncated to "6"....?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Matching two real numbers in a string using regex
by japhy (Canon) on Sep 06, 2002 at 03:13 UTC | |
|
Re: Matching two real numbers in a string using regex
by Silicon Cactus (Scribe) on Sep 06, 2002 at 14:35 UTC | |
by Flexx (Pilgrim) on Sep 06, 2002 at 14:45 UTC | |
by Silicon Cactus (Scribe) on Sep 06, 2002 at 18:54 UTC | |
by Flexx (Pilgrim) on Sep 07, 2002 at 12:38 UTC | |
|
Re: Matching two real numbers in a string using regex
by Flexx (Pilgrim) on Sep 06, 2002 at 14:42 UTC |