Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
AS:i:-4 AS:i:4
Is there a regex pattern that could capture the number (both -4 and 4) from these strings? I would ordinarily use /\d+/ to remove all non-numeric characters however I do not know how to handle an extra character that may or may not be there without having to use 2 regexes e.g. /-\d+/ and /\d+/.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Remove all non-numeric characters except for an optional negative sign (-)
by choroba (Cardinal) on Sep 09, 2016 at 12:55 UTC | |
Re: Remove all non-numeric characters except for an optional negative sign (-)
by pme (Monsignor) on Sep 09, 2016 at 12:57 UTC | |
Re: Remove all non-numeric characters except for an optional negative sign (-)
by kennethk (Abbot) on Sep 09, 2016 at 17:00 UTC |