resharp 0.5.1

high-performance regex engine with intersection and complement operations
Documentation
description = '''
semantic matching tests: password validation, permutations, multiline complement.
matches = [[start, end]] in utf8 bytes (half-open intervals).
'''

[[test]]
name = "semantics_password_offset"
pattern = '~(.*\d\d.*)&[a-zA-Z\d]{8,}'
input = "y tej55zhA25wXu8bvQxFxt o"
matches = [[11, 23]]

[[test]]
name = "semantics_lowercase_req"
pattern = '.*[a-z].*&[a-zA-Z\d]{8,}'
input = "y tej55zhA25wXu8bvQxFxt o"
matches = [[2, 23]]

[[test]]
name = "semantics_multi_intersection"
pattern = '.*[a-z].*&.*[A-Z].*&.*\d.*&[a-zA-Z\d]{8,}&~(.*\d\d.*)'
input = "y tej55zhA25wXu8bvQxFxt o"
matches = [[11, 23]]

[[test]]
name = "semantics_permutation"
pattern = '\((_*A_*B_*C_*|_*A_*C_*B_*|_*B_*A_*C_*|_*B_*C_*A_*|_*C_*A_*B_*|_*C_*B_*A_*)\)'
input = "(A----B----C)"
matches = [[0, 13]]

[[test]]
name = "semantics_startset"
pattern = "lethargy.*air"
input = "\nlethargy, and and the air tainted with\nc\n"
matches = [[1, 26]]

[[test]]
name = "semantics_html_comment"
pattern = '<!--[\s\S]*--[ \t\n\r]*>'
input = "<!-- anything -- >"
matches = [[0, 18]]

[[test]]
name = "semantic_multiline_complement"
pattern = '''~(_*(\n_*){2})&_*g_*&~(_*")&[A-Za-z]{5}_*'''
input = "\nThe fists of all the generals came down this time, and again the\nKing's eye sparkled with pleasure. The Chancellor sprang to his\nfeet and appealed to his Majesty:\n\n\"Sire, I claim your protection.\"\n\nBut the King waved him to his seat again, saying:\n"
matches = [[5, 129], [212, 249]]

[[test]]
name = "semantic_html_no_match"
pattern = '<h.{1,60}>.*<\/h(5|3|2|1|4)>'
input = '<li><a href="/wiki/Lattes_Editori" title="Lattes Editori">Lattes Editori</a></li>'
matches = []

[[test]]
name = "semantic_neg_lookbehind_unicode"
pattern = '(?<!鿛)(apres)\b'
input = "鿛apres"
matches = []

[[test]]
name = "semantic_lookbehind_boolean_log"
pattern = '(?<=6|8\(|4|8|0\().*&~(.*\)\:.*)&\w.*&.*\w&.*(?=.*\)\:)&.*(?=\)\:|\)\:)'
input = "\nJan 12 06:26:19: ACCEPT service http from 119.63.193.196 to firewall(pub-nic), prefix: \"none\" (in: eth0 119.63.193.196(5c:0a:5b:63:4a:82):4399 -> 140.105.63.164(50:06:04:92:53:44):80 TCP flags: ****S* len:60 ttl:32)\nJan 12 06:26:20: ACCEPT service dns from 140.105.48.16 to firewall(pub-nic-dns), prefix: \"none\" (in: eth0 140.105.48.16(00:21:dd:bc:95:44):4263 -> 140.105.63.158(00:14:31:83:c6:8d):53 UDP len:576 ttl:64)"
matches = [[48, 137], [140, 179], [260, 354], [357, 396]]