in reply to How to write a regular expression to extract a number from an embedded string?
If you want to allow anything in there (not just space, but letters or punctuation) you could usemy $numbers = $string =~ /(5163(?:\s*\d){8})/;
It's all about figuring out exactly what you want.my $numbers = $string =~ /(5163(?:\D*\d){8})/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to write a regular expression to extract a number from an embedded string?
by davido (Cardinal) on Jul 28, 2004 at 20:28 UTC | |
by Eimi Metamorphoumai (Deacon) on Jul 28, 2004 at 20:42 UTC | |
by davido (Cardinal) on Jul 28, 2004 at 20:45 UTC |