BeRo1985 / flre

FLRE - Fast Light Regular Expressions - A fast light regular expression library
GNU Lesser General Public License v2.1
94 stars 23 forks source link

When there are multiple possible local matches, but only one match leads to a global match.... #74

Open benibela opened 3 years ago

benibela commented 3 years ago

These should match:


assertMatch('([a-c]*)\1', 'abcabc'); //p282
assertMatch('(a)|\1', 'x'); //p294
assertMatch('(?:(b)?a)\1', 'a'); //p295
assertMatch('^((.)?a\2)+$', 'babadad'); //p303
assertMatch('(.*)\d+\1', 'abc12bc'); //p955
assertMatch('^.{3,4}(.+)\1$', 'foobarbar'); //p995
assertMatch('^(?:f|o|b){3,4}(.+)\1$', 'foobarbar'); //p996
assertMatch('^.{3,4}((?:b|a|r)+)\1$', 'foobarbar'); //p997
assertMatch('^(?:f|o|b){3,4}((?:b|a|r)+)\1$', 'foobarbar'); //p998
assertMatch('^.{3,4}(.+?)\1$', 'foobarbar'); //p999
assertMatch('^(?:f|o|b){3,4}(.+?)\1$', 'foobarbar'); //p1000
assertMatch('^.{3,4}((?:b|a|r)+?)\1$', 'foobarbar'); //p1001
assertMatch('^(?:f|o|b){3,4}((?:b|a|r)+?)\1$', 'foobarbar'); //p1002
assertMatch('^.{2,3}?(.+)\1$', 'foobarbar'); //p1003
assertMatch('^(?:f|o|b){2,3}?(.+)\1$', 'foobarbar'); //p1004
assertMatch('^.{2,3}?((?:b|a|r)+)\1$', 'foobarbar'); //p1005
assertMatch('^(?:f|o|b){2,3}?((?:b|a|r)+)\1$', 'foobarbar'); //p1006
assertMatch('^.{2,3}?(.+?)\1$', 'foobarbar'); //p1007
assertMatch('^(?:f|o|b){2,3}?(.+?)\1$', 'foobarbar'); //p1008
assertMatch('^.{2,3}?((?:b|a|r)+?)\1$', 'foobarbar'); //p1009
assertMatch('^(?:f|o|b){2,3}?((?:b|a|r)+?)\1$', 'foobarbar'); //p1010
assertMatch('^(.)(?:(.)+)*[BX]', 'ABCDE'); //p1705

the last one does not even have a backreference

flreperltest.txt