Currently I’m using this Regex code I found from other forums:
However, this also removes the negative sign, which I’ll need to be able to differentiate between positive value and negative value.
How can I be able to exclude the negative signs?
Currently I’m using this Regex code I found from other forums:
However, this also removes the negative sign, which I’ll need to be able to differentiate between positive value and negative value.
How can I be able to exclude the negative signs?
add -? at the beginning
when more thinking on amounts
Or
Sorry, where do you mean by “the beginning”?
Sorry I’m not familiar with those expressions, I would like to ignore the commas, would this ignore or include the commas?
The beginning of your regex expression.
for prototypes: https://regex101.com/
go for the first pattern or
Like this? This didn’t work
keep in mind: \-?\d+
is used for match and not for replace as shown in the screenshots
As replace can have side effects when input text can be like:
Like this? This also didn’t work
we shared the cheatsheet with you
…Regex.Match(…).Value
You realize Regex.Replace replaces the matched characters with what’s in the third string which in your case is “” right?
Are you trying to extract the number, including the - character? Or are you trying to erase all digits and the - sign, which is what your Replace statement is meant for?
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.