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

Infinite loop #2

Open
davidnduffy opened this issue Jan 6, 2022 · 1 comment
Open

Infinite loop #2

davidnduffy opened this issue Jan 6, 2022 · 1 comment

Comments

@davidnduffy
Copy link

davidnduffy commented Jan 6, 2022

Creating a call like this will not return (at least not in the several minutes I tried waiting for it):

RegSeed regExGen = new RegSeed("(prefix://([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}).*$)");
string result = regExGen.Generate();

Taking the .*$ off the end of the pattern makes it run but then not generate any random data after the prefix://GUID portion (obviously).

I can constrain the number of characters generated manually by inserting something like {5} or {1, 50} or {,50} in place of the * but the result will include the $ character and not pass a regex test of the pattern against the result.

@davidnduffy
Copy link
Author

I believe that because the pattern says .* which is greedy the generator just never stops generating characters and you can watch memory increase as the string builder keeps doubling.
While it is logical to treat .* as generate forever that isn't practical and should probably be replaced with a random number of characters within a reasonable or configurable limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant