Jean_Claude Posted May 14, 2019 Share Posted May 14, 2019 Can someone explain in «digestible language» what is the differences between Regular Expression vs Locale Aware Regular Expression we can use in the find/Replace with field. When one should be use and what benefits a user can have to use the other? Thanks! Old Bruce 1 Quote Link to comment Share on other sites More sharing options...
garrettm30 Posted May 14, 2019 Share Posted May 14, 2019 This is what was said in the beta where the feature was introduced: Quote -- 'Locale Aware Regular Expression' - Find / Replace will be performed using the locale inferred from the text being searched and locale aware collation is implied-- Please note that a 'Locale Aware Regular Expression' has to treat each block of text with a different language setting in isolation Source Thread In this mode, somehow regex takes into account the language encoding that the searched text is in. I am struggling to think of any examples of when or how to use it, so I am eager to see what the others say. Old Bruce 1 Quote Link to comment Share on other sites More sharing options...
walt.farrell Posted May 15, 2019 Share Posted May 15, 2019 The collation sequence is certainly part of it. For example, consider the regular expression [a-z] and the text string aàáâãäå A Find using a Regular Expression in Publisher will match only the first character ("a") but using a locale-aware regular expression will match each of them (one at a time, of course). On the other hand \w or [\w] will match each of those letters whether you use the locale-aware option or not, at least for English text. The comment in the Help about treating each block of text in a different language in isolation is also important. Given a text string of "aaaabbbb" where "aaaa" has one language specified, and bbbb has a different language specified, the locale-aware regular expression \w+ will match "aaaa" and "bbbb" separately. The non-locale-aware version will match the entire string "aaaabbbb". garrettm30 and lacerto 2 Quote -- Walt Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases PC: Desktop: Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 Laptop: Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU. iPad: iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard Mac: 2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1 Link to comment Share on other sites More sharing options...
garrettm30 Posted May 15, 2019 Share Posted May 15, 2019 That is a real advantage indeed for foreign languages! In the past I have resorted to tricks like [a-zéèêëïîôàùç]. I am so glad to understand this distinction. Thank you. Quote Link to comment Share on other sites More sharing options...
rcheetah Posted July 6, 2019 Share Posted July 6, 2019 Oh, now I understand. Very well done! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.