Home > Enterprise >  Removed HalfWidth and Fullwidth spaces regex
Removed HalfWidth and Fullwidth spaces regex

Time:12-02

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!

CodePudding user response:

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