Welcome Guest

Pages: 1
regex case transformation
Andy SPostJuly 20, 2025, 11:25
Newbie
Posts: 19
Registered:
May 11, 2017, 11:33
Normal topicregex case transformation

Hi Barry,

I'm trying to figure out how to use the \L or \U tokens for lowercase or uppercase transformation in the Regular expression's Replace template in Yate with not much success.

\L$1

Is it even possible? I don't see them listed in Yates' Regular Expression Metacharacters list.

--
Andy

2MR2PostJuly 20, 2025, 12:04
Avatar photo
Administrator
Posts: 2362
Registered:
August 23, 2012, 19:27
Normal topicregex case transformation

Apple's regular expression parser is based on the ICU parser. It uses flags to control alphabetic case in the match sequence.

If you're using the Regular Expression statement you can force the entire expression to be case insensitive as an option in the statement itself.

If you're using a regexp anywhere else in Yate you can use the flags: (?i) to enable case insensitivity and (?-i) to disable it. You can get at the flags from an action field's context menu.

As far as I know, there is no way to force case transformations via the replace template. You have to do it post extraction. You can extract ranges of everything matched and build up a new result doing case transformations on a range of the result. It's not pretty. 🙁

BTW: As ICU does not use \L, Yate repurposes it to mean ignore regexp sequences in everything that follows.

Andy SPostJuly 20, 2025, 12:24
Newbie
Posts: 19
Registered:
May 11, 2017, 11:33
Normal topicregex case transformation
Quote from 2MR2 on July 20, 2025, 12:04

Apple's regular expression parser is based on the ICU parser.

[…]

As far as I know, there is no way to force case transformations via the replace template. You have to do it post extraction. You can extract ranges of everything matched and build up a new result doing case transformations on a range of the result. It's not pretty. 🙁

😥

Thanks for the confirmation... I guess! 😀

--
Andy

2MR2PostJuly 22, 2025, 15:30
Avatar photo
Administrator
Posts: 2362
Registered:
August 23, 2012, 19:27
Normal topicregex case transformation

This one annoyed me as it seems as if is a useful feature. I've investigated and found that I can extend the Apple regexp functionality and implement it with a slightly different syntax.

I can allow case transformations in the replace template within a capture group. $L1 would mean insert capture group 1 all in lower case. $U3 would mean insert capture group 3 all in upper case. $2 would be a typical insert capture group 2 without any case conversion.

Would this work for you?

Andy SPostJuly 23, 2025, 08:10
Newbie
Posts: 19
Registered:
May 11, 2017, 11:33
Normal topicregex case transformation

Barry, you're a genius!
That's exactly what I want.
Many thanks as always. 😉

--
Andy

2MR2PostJuly 23, 2025, 09:54
Avatar photo
Administrator
Posts: 2362
Registered:
August 23, 2012, 19:27
Normal topicregex case transformation

Thanks for letting me know. It will also work with named capture groups. $L(?<name> ...)

It'll be in v8.2.3

2MR2PostJuly 23, 2025, 09:57
Avatar photo
Administrator
Posts: 2362
Registered:
August 23, 2012, 19:27
Normal topicregex case transformation

Oops bad example: $L{name}

It works in the replace template only.

2MR2PostJuly 31, 2025, 16:30
Avatar photo
Administrator
Posts: 2362
Registered:
August 23, 2012, 19:27
Normal topicregex case transformation

Released in v8.2.3 today

Andy SPostAugust 1, 2025, 11:47
Newbie
Posts: 19
Registered:
May 11, 2017, 11:33
Normal topicregex case transformation

Does the job perfectly.
Many thanks.

--
Andy

Pages: 1
Mingle Forum by Cartpauj | Version: 1.1.0beta | Page loaded in: 0.034 seconds.