toraritte / program

1 stars 0 forks source link

\b does not match the corner case where text literal starts with % #10

Open toraritte opened 5 years ago

toraritte commented 5 years ago

https://blogs.msdn.microsoft.com/oldnewthing/20100423-00/?p=14263

$ echo "%{1" | priv/bin/pcre2grep "^\\b(.*)\\b$"
$ echo "%{1" | priv/bin/pcre2grep "^\\W(.*)\\W$"
$ echo "%{1" | priv/bin/pcre2grep "^\\w(.*)\\w$"
$ echo "%{1" | priv/bin/pcre2grep "^\\W(.*)\\b$"
%{1

Make the basic regex pattern more generic.