The first character after \u\L that is inserted into the replacement text as a literal or by a token is converted to uppercase and the following characters up to the next \E or \U are converted to lowercase.

Replacing (\w+)(\w+) with \u\L$1\uCrUeL \E\u$2 in HeLlO wOrLd yields Hello Cruel WOrLd

The first character after \l\U that is inserted into the replacement text as a literal or by a token is converted to lowercase and the following characters up to the next \E or \L are converted to uppercase.

Replacing (\w+)(\w+) with \l\U$1\lCrUeL \E\l$2 in HeLlO WoRlD yields hELLO cRUEL woRlD

The first character after \L\u that is inserted into the replacement text as a literal or by a token is converted to uppercase and the following characters up to the next \E or \U are converted to lowercase.

Replacing (\w+)(\w+) with \L\u$1\uCrUeL \E\u$2 in HeLlO wOrLd yields Hello Cruel WOrLd

The first character after \U\l that is inserted into the replacement text as a literal or by a token is converted to lowercase and the following characters up to the next \E or \L are converted to uppercase.

Replacing (\w+)(\w+) with \U\l$1\lCrUeL \E\l$2 in HeLlO WoRlD yields hELLO cRUEL woRlD