\U, \u, \L, \l and \E in Search & Replace fields

I have been looking in the Wiki to find information about using the new switches \U, \u, \L, \l and \E in Search & Replace fields.

I'd be grateful for information about how to use them.

They are covered in the Tokens user manual section.

They are not specific to Search & Replace, they can be used in any token fields, it is just more common generally to use them in search and replace.

  • \U converts everything up to the next \L or \E to uppercase.
  • \L converts everything up to the next \U or \E to lowercase.
  • \u converts the next character to uppercase.
  • \l converts the next character to lowercase.
  • \U\l lowercase first, then uppercase.
  • \L\u uppercase first, then lowercase.
  • \E stop changing case.

For example, you can use \U%LongDate%\E to get the date in allcaps.

3 Likes

Since the genesis of these metacharacters is RegEx, they should also be documented in the RegEx section of the Wiki

Are they really part of the ICU Regexes now? Couldn’t find them there, but often I’m blind.

(I know, they exist in other flavors.)

Or is this a KM-only supplement to ICU?

Tom, I don't know for sure, but I think not -- ICU supports only the most basic metadata in replacements:

image

I give @peternlewis great credit and thanks for providing us with these metadata in KM RegEx.

1 Like

No, they are not part of regex per se.

They are often used in search & replace replacement strings.

So really they are a form of text processing in the replacement strings, together with other text processing like $1 or \n. Some of them are search & replace specific, some of them are string processing in general.

They are referenced in the Search and Replace action, as they should be since it is a common place to use them. But they are documented in the tokens section, since they can be used anywhere tokens can be. We don't want to duplicate their actual description in the regex action.

2 Likes

That works for me, and I think it should be clear to most readers.
Thanks.