Re: How best to work around the issue - regex string cannot contain brackets

Поиск
Список
Период
Сортировка
От Steve Midgley
Тема Re: How best to work around the issue - regex string cannot contain brackets
Дата
Msg-id CAJexoS+QpHS3tdn9ff7kfVYqXmEFhw3=8zV-ZM8K8UW0JLkg8Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: How best to work around the issue - regex string cannot contain brackets  (Shaozhong SHI <shishaozhong@gmail.com>)
Ответы Re: How best to work around the issue - regex string cannot contain brackets  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-sql


On Fri, Feb 4, 2022 at 6:01 AM Shaozhong SHI <shishaozhong@gmail.com> wrote:
It appears that the following regex work differently.

Why \d and [\d] are different?

[A-PR-UWYZ]\d{1,2} and [A-PR-UWYZ][\d]{1,2}


This is getting into regex stuff, where maybe stackoverflow is a better resource? But when you put characters into brackets, you are telling regex to search for each character represented in the bracket. So [\d] is looking for any single character that is either a \ or a d character. Outside of brackets, regex evaluates \d as any digit. For US English charset [0-9] is equivalent to \d I believe.

В списке pgsql-sql по дате отправления:

Предыдущее
От: Shaozhong SHI
Дата:
Сообщение: Re: How best to work around the issue - regex string cannot contain brackets
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: How best to work around the issue - regex string cannot contain brackets