in reply to How to write a regular expression to extract a number from an embedded string?
How about this?
Update: modified code. Thanks davidomy $string = 'abcdef 5163 1234 5678'; my $extracted = $string =~ /(5163(?:\d{8}|\s\d{4}\s\d{4}))/;
|
|---|
| 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:24 UTC |