Scanning a string for decimal numbers

Thank you for clearing things, up for me, but could you explain what the
last part of the expression Wilson provided me with means?

it’s (?=[^\d])

2006/2/13, Josef ‘Jupp’ SCHUGT [email protected]:

DÅ?a Utorok 14 Február 2006 19:07 Jeppe J. napísal:

Thank you for clearing things, up for me, but could you explain what the
last part of the expression Wilson provided me with means?

it’s (?=[^\d])

That’s a positive zero-width lookahead. I think. Gotta love regexspeak.

In English: look for a single character that’s not a decimal digit, and
don’t
include it in the match.

David V.

David V. wrote:

DÅ?a Utorok 14 Február 2006 19:07 Jeppe J. napísal:

Thank you for clearing things, up for me, but could you explain what
the last part of the expression Wilson provided me with means?

it’s (?=[^\d])

These is equivalent (?=\D)

A negative lookahead might work, too: (?!\d)

That’s a positive zero-width lookahead. I think. Gotta love
regexspeak.

In English: look for a single character that’s not a decimal digit,
and don’t include it in the match.

I’d go with this quite simple regexp

/[-+]?\d+(?:,\d+)?/

If numbers like “1,” should be detected, too, then just change the “+”
in
the last group to “*”.

If one wants to prevent to match numbers with leading zeros then it
becomes more complicated but it seems not be worth the effort in this
case.

Kind regards

robert