freebsd-dev/lib/libregex/tests/gnuext.in
Kyle Evans 6b986646d4 libregex: implement \b and \B (word boundary, not word boundary)
This is the last of the needed GNU expressions before we can unleash bsdgrep
by default. \b is effectively an agnostic equivalent of \< and \>, while
\B will match every space that isn't making a transition from
nonchar -> char or char -> nonchar.
2020-12-05 03:16:05 +00:00

35 lines
709 B
Plaintext

# BRE Quantifiers
ab\?c b abc abc
ab\+c b abc abc
# BRE Branching
abc\|de b abc abc
a\|b\|c b abc a
\(ab\|bc\) b abcd ab
# ERE Backrefs
(ab)\1 - ab
(ab)\1 - abab abab
\1(ab) C ESUBREG
(a)(b)(c)(d)(e)(f)(g)(h)(i)\9 - abcdefghii abcdefghii
# \w, \W, \s, \S (alnum, ^alnum, space, ^space)
\w+ - -%@a0X- a0X
\w\+ b -%@a0X- a0X
\s+ - aSNTb SNT
\s\+ b aSNTb SNT
# Word boundaries (\b, \B, \<, \>, \`, \')
# (is/not boundary, start/end word, start/end subject string)
\babc\b & <abc> abc
\<abc\> & <abc> abc
\Babc\B & abc
\B[abc]\B & <abc> b
\B[abc]+ - <abc> bc
\B[abc]\+ b <abc> bc
\`abc & abc abc
abc\' & abc abc
\`abc\' & abc abc
\`.+\' - abNc abNc
\`.\+\' b abNc abNc
(\`a) - Na
(a\`) - aN
(a\') - aN
(\'a) - Na