# This file tests the auxiliary pattern conversion features of the PCRE2
# library, in non-UTF mode.
#forbid_utf
#newline_default lf any anycrlf
# -------- Tests of glob conversion --------
# Set the glob separator explicitly so that different OS defaults are not a
# problem. Then test various errors.
#pattern convert=glob,convert_glob_separator=/
/abc/posix
** The convert and posix modifiers are mutually exclusive
# Separator must be / \ or .
/a*b/convert_glob_separator=%
** Invalid glob separator '%'
# Can't have separator in a class
"[ab/cd]"
(?s)\A[ab/cd](?/
(?s)\A<[a-c\-d]>\z
0:
0:
0:
0:
<->
0: <->
/a[[:digit:].]z/
(?s)\Aa[[:digit:].](?/
** Pattern conversion error at offset 6: missing terminating ] for character class
<[>
<:>
<9>
\= Expect no match
/a*b/convert_glob_separator=\
(?s)\Aa(*COMMIT)[^\\]*?b\z
/a*b/convert_glob_separator=.
(?s)\Aa(*COMMIT)[^\.]*?b\z
/a*b/convert_glob_separator=/
(?s)\Aa(*COMMIT)[^/]*?b\z
# Non control character checking
/A\B\\C\D/
(?s)\AAB\\CD\z
/\\{}\?\*+\[\]()|.^$/
(?s)\A\\\{\}\?\*\+\[\]\(\)\|\.\^\$\z
/*a*\/*b*/
(?s)\A[^/]*?a(*COMMIT)[^/]*?/(*COMMIT)[^/]*?b(*COMMIT)[^/]*+\z
/?a?\/?b?/
(?s)\A[^/]a[^/]/[^/]b[^/]\z
/[a\\b\c][]][-][\]\-]/
(?s)\A[a\\bc][]][\-][\]\-]\z
/[^a\\b\c][!]][!-][^\]\-]/
(?s)\A[^/a\\bc][^/]][^/\-][^/\]\-]\z
/[[:alpha:][:xdigit:][:word:]]/
(?s)\A[[:alpha:][:xdigit:][:word:]](?[^/]*?a)(?>[^/]*?b)(?>[^/]*?g)(?>[^/]*?n)(?>[^/]*?t\z)
abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txt
0: /abcdefghijklmnop.txt
/**\/*a*\/**/
(?s)(?:\A|/)(?>[^/]*?a)(?>[^/]*?/)
xx/xx/xx/xax/xx/xb
0: /xax/
/**\/*a*/
(?s)(?:\A|/)(?>[^/]*?a)(?>[^/]*+\z)
xx/xx/xx/xax
0: /xax
xx/xx/xx/xax/xx
No match
/**\/*a*\/**\/*b*/
(?s)(?:\A|/)(?>[^/]*?a)(?>[^/]*?/)(*COMMIT)(?:.*?/)??(?>[^/]*?b)(?>[^/]*+\z)
xx/xx/xx/xax/xx/xb
0: /xax/xx/xb
xx/xx/xx/xax/xx/x
No match
#pattern convert=glob:glob_no_starstar
/***/
(?s)\A[^/]*+\z
/**a**/
(?s)\A[^/]*?a(*COMMIT)[^/]*+\z
#pattern convert=unset
#pattern convert=glob:glob_no_wild_separator
/*/
(?s)
/*a*/
(?s)a
/**a**/
** Pattern conversion error at offset 2: invalid syntax
/a*b/
(?s)\Aa(*COMMIT).*?b\z
/*a*b*/
(?s)a(*COMMIT).*?b
/??a??/
(?s)\A..a..\z
#pattern convert=unset
#pattern convert=glob,convert_glob_escape=0
/a\b\cd/
(?s)\Aa\\b\\cd\z
/**\/a/
** Pattern conversion error at offset 2: invalid syntax
/a`*b/convert_glob_escape=`
(?s)\Aa\*b\z
/a`*b/convert_glob_escape=0
(?s)\Aa`(*COMMIT)[^/]*?b\z
/a`*b/convert_glob_escape=x
** Invalid glob escape 'x'
#pattern convert=unset:posix_extended
/a[[:>:]z/
a[[:>:]z
Failed: error 130 at offset 4: unknown POSIX class name
/<[[:a[:digit:]b]>/
<[[:a[:digit:]b]>
<[>
0: <[>
<:>
0: <:>
0:
<9>
0: <9>
0:
\= Expect no match
No match
/a+\1b\\c|d[ab\c]/
a+1b\\c|d[ab\\c]
/a[[:<:]]b[[:>:]]/
a[[:<:]]b[[:>:]]
/<[]bc]>/
<[]bc]>
<]>
0: <]>
0:
0:
/<[^]bc]>/
<[^]bc]>
<.>
0: <.>
\= Expect no match
<]>
No match
No match
/(a)\1b/
(a)1b
a1b
0: a1b
1: a
\= Expect no match
aab
No match
/(ab)c)d]/
(ab)c\)d\]
Xabc)d]Y
0: abc)d]
1: ab
/a***b/
a*b
#pattern convert=unset:posix_basic
/a*b+c\+[def](ab)\(cd\)/
a*b\+c+[def]\(ab\)(cd)
/\(a\)\1b/
(a)\1b
aab
0: aab
1: a
\= Expect no match
a1b
No match
/how.to how\.to/
how.to how\.to
/^how to \^how to/
^how to \^how to
/^*abc/
^\*abc
/*abc/
\*abc
X*abcY
0: *abc
/**abc/
\**abc
XabcY
0: abc
X*abcY
0: *abc
X**abcY
0: **abc
/^b\(c^d\)\(^e^f\)/
^b(c\^d)(^e\^f)
/a***b/
a*b
#pattern convert=unset
/abc/
# End of testinput24