# 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:].]z\z a1z 0: a1z a.z 0: a.z \= Expect no match a:z No match /a[[:digit].]z/ (?s)\Aa[\[:digit]\.\]z\z a[.]z 0: a[.]z a:.]z 0: a:.]z ad.]z 0: ad.]z /<[[:a[:digit:]b]>/ (?s)\A<[\[:a[:digit:]b]>\z <[> 0: <[> <:> 0: <:> 0: <9> 0: <9> 0: \= Expect no match 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 /[[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:word:][:xdigit:]]/ (?s)\A[[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:word:][:xdigit:]](?[^/]*?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 "**a"convert=glob (?s)a\z a 0: a c/b/a 0: a c/b/aaa 0: a "a**/b"convert=glob (?s)\Aa(*COMMIT).*?/b\z a/b 0: a/b ab No match "a/**b"convert=glob (?s)\Aa/(*COMMIT).*?b\z a/b 0: a/b ab 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**/ (?s)a /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/ (?s)\\/a\z /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' # -------- Tests of extended POSIX conversion -------- #pattern convert=unset:posix_extended /<[[:a[:digit:]b]>/ (*NUL)<[[:a[:digit:]b]> <[> 0: <[> <:> 0: <:> 0: <9> 0: <9> 0: \= Expect no match No match /a+\1b\\c|d[ab\c]/ (*NUL)a+1b\\c|d[ab\\c] /<[]bc]>/ (*NUL)<[]bc]> <]> 0: <]> 0: 0: /<[^]bc]>/ (*NUL)<[^]bc]> <.> 0: <.> \= Expect no match <]> No match No match /(a)\1b/ (*NUL)(a)1b a1b 0: a1b 1: a \= Expect no match aab No match /(ab)c)d]/ (*NUL)(ab)c\)d\] Xabc)d]Y 0: abc)d] 1: ab /a***b/ (*NUL)a*b # -------- Tests of basic POSIX conversion -------- #pattern convert=unset:posix_basic /a*b+c\+[def](ab)\(cd\)/ (*NUL)a*b\+c\+[def]\(ab\)(cd) /\(a\)\1b/ (*NUL)(a)\1b aab 0: aab 1: a \= Expect no match a1b No match /how.to how\.to/ (*NUL)how.to how\.to how\nto how.to 0: how\x0ato how.to \= Expect no match how\x{0}to how.to No match /^how to \^how to/ (*NUL)^how to \^how to /^*abc/ (*NUL)^\*abc /*abc/ (*NUL)\*abc X*abcY 0: *abc /**abc/ (*NUL)\**abc XabcY 0: abc X*abcY 0: *abc X**abcY 0: **abc /*ab\(*cd\)/ (*NUL)\*ab(\*cd) /^b\(c^d\)\(^e^f\)/ (*NUL)^b(c\^d)(^e\^f) /a***b/ (*NUL)a*b # End of testinput24