RegEx and capitalized placeables/tokens containing accented characters

Former Member
Former Member

I'm a new user of Studio 2021. Apologies if the following has already been discussed, but I couldn't find it in my search results...

I've set up Regex Match AutoSuggest to recognise capitalised words so that I can place them in my target TU, with the following Regex Pattern:

([A-Z][a-zA-Z]*\s*)+

This generally works very well (although I can't imagine why this isn't a standard function within Studio), but it falls down when the capitalised word contains an accented letter. For example Frédéric would only be recognised as far as "Fr". Can I enhance my Regex pattern to include standard French accented characters, or to cover the whole word regardless of accents?

Thanks in advance,

Matthew

Parents
  • Your solution only takes into account the ranges of letters you have specified. In order to avoid listing all accented characters, you can use the following specific Unicode classes:

    • \p{L}
      any kind of letter from any language
    • \p{Ll}
      any lowercase letter that has an uppercase variant
    • \p{Lu}
      any uppercase letter that has a lowercase variant

    Your optimized search pattern would then look like this:

    (\p{Lu}\p{L}*\b\s*)+

    I hope this helps! Don't hesitate if it doesn't work as expected or if anything is unclear!

    Kind regards,
    Raphaël

Reply
  • Your solution only takes into account the ranges of letters you have specified. In order to avoid listing all accented characters, you can use the following specific Unicode classes:

    • \p{L}
      any kind of letter from any language
    • \p{Ll}
      any lowercase letter that has an uppercase variant
    • \p{Lu}
      any uppercase letter that has a lowercase variant

    Your optimized search pattern would then look like this:

    (\p{Lu}\p{L}*\b\s*)+

    I hope this helps! Don't hesitate if it doesn't work as expected or if anything is unclear!

    Kind regards,
    Raphaël

Children