On Fri, Sep 12, 2025 at 3:54 PM jian he <[email protected]> wrote:
> > > select v from t where v similar to 'foo[\d\w]_%';
> > > select v from t where v similar to 'foo[[[:digit:]][[:word:]]]_%';

> The above two examples are the same, per
> (Table 9.21. Regular Expression Class-Shorthand Escapes)

Of course.

> my guess why 'foo0bar' will fail for 'foo[[[:digit:]][[:word:]]]_%';
> 1. process character 0, it does meet [[:digits]] character class.
> 2. process character b, it does not meet [[:digits]], then fails,
> it won't check again whether character b is satisfied with [[:word:]] or not.

Then you don't know what [...] means in regexes I'm afraid. --DD


Reply via email to