Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{article}
- usepackage{expl3}
- begin{document}
- ExplSyntaxOn
- cs_set:Npn prepare_regex:N #1 {
- cs_set_nopar:Npn l_tmpa_regex {
- __regex_branch:n {
- __regex_assertion:Nn c_true_bool { char`^ __regex_anchor:N l__regex_min_pos_int }
- __regex_class:NnnnN c_true_bool {__regex_item_caseful_equal:n {97}}{1}{-1} #1
- __regex_assertion:Nn c_true_bool { X __regex_break_true:w }
- __regex_class:NnnnN c_true_bool { use:c{__regex_prop_.:} }{0}{-1} c_false_bool
- __regex_assertion:Nn c_true_bool { char`$ __regex_anchor:N l__regex_max_pos_int }
- }
- }
- }
- cs_set:Npn test_match:n #1 {
- #1:~
- regex_extract_once:NnNTF l_tmpa_regex {#1} l_tmpa_seq {}{}
- par
- }
- ttfamily
- greedy~match: par
- prepare_regex:N c_false_bool
- test_match:n { ab }
- test_match:n { aab }
- test_match:n { aaab }
- test_match:n { aaaa }
- medskip
- lazy~match: par
- prepare_regex:N c_true_bool
- test_match:n { ab }
- test_match:n { aab }
- test_match:n { aaab }
- test_match:n { aaaa }
- ExplSyntaxOff
- end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement