Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative lookahead seems to not be working #37

Closed
cgutierrezpa opened this issue Oct 23, 2017 · 1 comment
Closed

Negative lookahead seems to not be working #37

cgutierrezpa opened this issue Oct 23, 2017 · 1 comment

Comments

@cgutierrezpa
Copy link

cgutierrezpa commented Oct 23, 2017

So I want to generate a random expression that does not contain a certain combination of characters. For example, let's imagine that I want to generate 2-character words with the letters 'a' and 'b' such that I can generate:

'aa'
'ab'
'ba'
'bb'

Then I want the generator to avoid generating one of those words, for instance 'aa', for which I created the following Regular Expression:

/((?!aa)[a-b]){2}/

However, a randexp based on this Regular Expression will be generating all of the words listed above, including 'aa' which is supposed to be skipped.

image

Isn't this considered by the algorithm? Is there something wrong with my Regular Expression? Or is there a bug in the algorithm?

Thanks in advance.

@fent
Copy link
Owner

fent commented Oct 25, 2017

Currently, negative lookaheads are ignored.

Dupe of #18

@fent fent closed this as completed Oct 25, 2017
@fent fent added the duplicate label Oct 25, 2017
@cgutierrezpa cgutierrezpa changed the title Negative lookup seems to not be working Negative lookahead seems to not be working Oct 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants