Jump to content
You must now use your email address to sign in [click for more info] ×

Regular Expression vs Locale Aware Regular Expression


Recommended Posts

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.

Link to comment
Share on other sites

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".

-- 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

  • 1 month later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.