Open JoshuaFox opened 1 year ago
See the test below, which shows that the syntax 1+:fewest gives the same results as 1+. Am I using the syntax wrong? Note also this issue, which seems related but not the same.
1+:fewest
1+
import re import ke search_str = "xxxbbcccbeeeeeeeeebxxx" greedy_kleenexp = ke.search('["b" [1+ #any ] "b"]', search_str, ).group(0) greedy_regexp = re.search(r'b.+b', search_str, ).group(0) nongreedy_kleenexp = ke.search('["b" [1+:fewest #any] "b"]', "%s" % search_str, ).group(0) nongreedy_regexp = re.search(r'b.+?b', search_str, ).group(0) assert greedy_regexp == greedy_kleenexp, f"{greedy_regexp}!={greedy_kleenexp}" assert nongreedy_regexp != greedy_regexp, f"{nongreedy_regexp}=={greedy_regexp}" # fails assert nongreedy_regexp == nongreedy_kleenexp, f"{nongreedy_regexp}!={nongreedy_kleenexp}" # fails assert nongreedy_kleenexp != greedy_kleenexp, f"{nongreedy_kleenexp}=={greedy_kleenexp}"
See the test below, which shows that the syntax
1+:fewest
gives the same results as1+
. Am I using the syntax wrong? Note also this issue, which seems related but not the same.