I am trying to remove the dollar format from the string \'$1,109,889.23\'. I tried using a regular expression with:
\"[^\\\\d]\"
but then I ge
I'm not sure I understand exactly what you want, but it seems that in your example you would want to end up with "1,109,889.23". If this is the case, why don't you simply select use [\d,.\x20]+
(note the period is not escaped, as it is in character set, and note the \x20 to select spaces if they use that instead of commas) to select just the number. If you want to select everything that is NOT part of the number, as your example indicates, then you would just search for [^\d,.\x20]
. This will work for any currency format, not just ones that use the dollar sign. It will also allow multiple types of punctuation, such as allowing spaces instead of commas to separate multiple numbers. However, I agree with Tim Pietzcker that a regular expression might not be the right tool for the job.
You don't need a regex for this.
Just use lsParseCurrency:
numericValue = lsParseCurrency('$1,109,889.23');
writeOutput(numericValue);
Example on trycf.com yields:
1109889.23
As per Leigh's commment below... if yer locale is something that doesn't use ,
and .
for the thousands and decimal separators (respectively)... make sure to specify the locale too, eg:
numericValue = lsParseCurrency('$1,109,889.23', 'en_us');