in reply to $1 and regex
That's not what you intend. A first cut at fixing this is to rewrite the regex so that it it won't gobble up extra digits on either side of "to". m!(\d+)\D+to\D+(\d+)!i; This will match target strings that have non-digit substrings surrounding the "to", but won't match "123to456", since there are no non-digit characters surrounding "to". If that's a problem, you can take the regex a step further, and write m!(\d+)\D*?to\D*?(\d+)!i; which will accept zero or more non-digit characters on either side of "to".(12)3to45(6) $1 $2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: $1 and regex
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 |