stefankueng / grepWin

A powerful and fast search tool using regular expressions
https://tools.stefankueng.com/grepWin.html
GNU General Public License v3.0
1.76k stars 188 forks source link

Replacement Text Case Conversion limited to [a-zA-Z] ?? #318

Closed KaDeeKe closed 2 years ago

KaDeeKe commented 2 years ago

Replacement Text Case Conversion placeholders (\L, \l, \U, \u, etc), as listed in GrepWin's F1, suggest they can convert ANY lowercase character to uppercase and vice versa.
This works fine on my GrepWin 2.0.10.1125 on W10 for the characters in the range [a-zA-Z], but it does not seem to apply in my environment to some characters used Scandinavian, French, Italian, Spanish ... languages. Examples: ö versus Ö; ç versus Ç; ù versus Ù; ñ versus Ñ; etc., ... I'm testing on a .srt-file with UTF8-encoding according to GrepWin. "Treat files as UTF8" makes no difference. From the paragraph "Boost’s Replacement String Case Conversion" in https://www.regular-expressions.info/replacecase.html the example «So when (?i)(helló) (wórld) matches HeLlÓ WóRlD you can use \L\u\1 \u\2 to replace the match with Helló Wórld.» suggests that it is not a limitation of the Boost Engine. Is my assessment correct that GrepWin cannot case-convert such characters and should its F1 be more modest :)? Or can I do something to circumvent this limitation?

stefankueng commented 2 years ago

can you provide a sample file and your exact search and replacement string?

KaDeeKe commented 2 years ago

Hi Stefan,

Small sample test-file: Bron.0.srt

1

00:16:41,080 --> 00:16:45,920

Politie MALMö, Saga Norén.

2

00:19:07,320 --> 00:19:12,240

Het is van Ölanders Livs in MALMö.

For sake of testing, I’d like to turn «Malmö» into All Capital Case.

Search for «\b(Malmö)\b»

Replace with «\U$1\E»

My result in Bron.1.srt

1

00:16:41,080 --> 00:16:45,920

Politie MALMö, Saga Norén.

2

00:19:07,320 --> 00:19:12,240

Het is van Ölanders Livs in MALMö.

I had hoped for MALMÖ iso MALMö ...

“Treat files as UTF8” makes no difference.

My W10 Language settings:

Kind regards,

Kurt

From: Stefan Küng @.> Sent: Monday, 21 March 2022 19:13 To: stefankueng/grepWin @.> Cc: KaDeeKe @.>; Author @.> Subject: Re: [stefankueng/grepWin] Replacement Text Case Conversion limited to [a-zA-Z] ?? (Issue #318)

can you provide a sample file and your exact search and replacement string?

— Reply to this email directly, view it on GitHub https://github.com/stefankueng/grepWin/issues/318#issuecomment-1074248394 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AYJWTDOFDAIQF5EU6U4AVDTVB C34FANCNFSM5RECPJPQ . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AYJWTDKIAE7F7VKCMZ3T5NDVBC34FA5CNFS M5RECPJP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOIAD3VSQ .gif Message ID: @. @.> >