From: Robert Klemme Date: 2006-02-15T18:28:26+09:00 Subject: Re: Scanning a string for decimal numbers David Vallner wrote: > Dňa Utorok 14 Február 2006 19:07 Jeppe Jakobsen 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