You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, thanks for this lib!
I have come across a weird behaviour using rstr.xeger: this pattern "(?:(?:^|;)(AAA|BBB|CCC))+$" aims to capture any string that contains groups of strings within ["AAA", "BBB", "CCC"], separated by semicolons. These are valid strings:
BBB;AAA
BBB;AAA;BBB
CCC
However xeger returns things like:
BBBCCC;CCCBBB : some groups are not separated
;AAA;BBBCCC : the separator is also at the start of the string
The text was updated successfully, but these errors were encountered:
Interesting. Someone else opened an issue asking about non-capturing groups, so I wonder if there's something we're handling incorrectly in that situation. I'll try to investigate when I have some time, but I'm also happy to review a PR if you're feeling ambitious. The group-handling is here.
I think the issue here is how we're handling the ^ character in combination with the + repeat.
A slightly modified version of your regex, '(?:(?:;)(AAA|BBB|CCC))+$' produces correctly matching strings. For example:
;AAA;BBB;BBB;CCC;BBB
;BBB;CCC;BBB;BBB;CCC;BBB;AAA;CCC;AAA;BBB;BBB
the separator is also at the start of the string
I think that's correct? In the group (?:^|;) this regex is saying match either the start-of-input anchor ^ or a semicolon ;. Unless there's something I'm misunderstanding, it's legitimate to start with ;
some groups are not separated
I think this is the bug, more or less: the "not separated" cases are the result of the situation where random.choice() has picked the ^ instead of the ; but we don't output any printable character for "start of input" so we wind up with repeats that are missing separators.
Hi, thanks for this lib!
I have come across a weird behaviour using
rstr.xeger
: this pattern"(?:(?:^|;)(AAA|BBB|CCC))+$"
aims to capture any string that contains groups of strings within["AAA", "BBB", "CCC"]
, separated by semicolons. These are valid strings:BBB;AAA
BBB;AAA;BBB
CCC
However
xeger
returns things like:BBBCCC;CCCBBB
: some groups are not separated;AAA;BBBCCC
: the separator is also at the start of the stringThe text was updated successfully, but these errors were encountered: