Removed HalfWidth and Fullwidth spaces regex

256 Views Asked by At

I have this regex code that removes leading and trailing white spaces.

regexreplaceall("^\s+|\s+$", ri!value, "")

However, it only removes halfwidth spaces.

Sample result process:

a) value(consist of half width spaces): " he llo "

   result: "he llo" -> correct

b) value(consist of fullwidth spaces): "  he llo  "

   result: "  he llo  " -> incorrect

Does anyone know whats the regex code for fullwidth spaces? Im Using Appian platform

Thank You everyone!

1

There are 1 best solutions below

0
On BEST ANSWER

You need to make the \s (and other) shorthand character class Unicode-aware.

Since Appian uses Java regex flavor, all you need is add the (?U) embedded flag option to the pattern:

regexreplaceall("(?U)^\s+|\s+$", ri!value, "")