RegexReplaceAll to filter out a string variable and keep the numeric value from it

0
Hello,   I want to use the RegexReplaceAll java action to filter out a string variable Variable_2 ( for example : $ 1000 ) that i created in order to keep just the numerical value (1000). Could you please tell me what I should put in Needle regex and Replacement.
asked
2 answers
0

To filter out the non-numerical characters (like the '$' sign) from the string using the RegexReplaceAll action in Mendix, you can use the following:

Needle (Regex): This is the pattern you want to search for and replace.

The regex to match non-digit characters (including the dollar sign '$') would be [^\\d]+.Explanation:[^\\d] matches any character that is not a digit.+ ensures that one or more occurrences of these non-digit characters are matched.

The other option is 

Replacement: This specifies what the matched pattern should be replaced with. In this case, you'd replace the non-digit characters with an empty string, effectively removing them.

The replacement string would be an empty string, "".So, in the Mendix RegexReplaceAll action:

Needle (Regex): [^\\d]+Replacement: ""So this configuration will remove any non-digit characters from your string, effectively leaving only the numerical values.

answered
0

Here as you can see the error that I get:

image.png

answered