regextrimappian

Removed HalfWidth and Fullwidth spaces regex


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!


Solution

  • 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, "")