1

I am trying to partition data on wether it matches a regex or not. The column contains the value 00000000081.48 and the expression is

str:matches(record:value('/OUT_HD_CURR_BAL'), '[0-9]+\.[0-9]+')

But it is behaving as if the output is false. Is anything wrong with the regex?

1 Answers1

1

I believe it should be

str:regExCapture(record:value('/OUT_HD_CURR_BAL'), '([0-9]+\.[0-9]+)', 1)

If you need to get the boolean with str:matches, add .* around your expression:

str:matches(record:value('/OUT_HD_CURR_BAL'), '.*[0-9]\.[0-9]+.*')

str:matches needs to match the string from start till end and .* matches any text.

Ryszard Czech
  • 18,032
  • 4
  • 24
  • 37
  • This would return a string, I need a boolean value which string:matches() gives. Am I wrong in my understanding of these functions? – Paawan Angra Jun 25 '21 at 13:31