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

Regexify method doesn't recognise "^" and "$" chars in datafaker before 2.2.0. #1209

Closed
maxtar opened this issue May 24, 2024 · 7 comments
Closed
Labels
wontfix This will not be worked on

Comments

@maxtar
Copy link
Contributor

maxtar commented May 24, 2024

Describe the bug
Faker().regexify() doesn't take into account "^" and "$" chars.

To Reproduce

Faker().regexify("^\d{10}$")

will make something like ^4111968277$

Expected behavior

In regex "^" char means start of string and "$" - end of string. regexify must recognise this chars. Result must be 4111968277.

Versions:

  • JDK 11
  • Faker Version 1.9.0
@snuyanzin snuyanzin changed the title Regexify method doesn't recognise "^" and "$" chars. Regexify method doesn't recognise "^" and "$" chars in datafaker before 2.2.0. May 24, 2024
@snuyanzin
Copy link
Collaborator

snuyanzin commented May 24, 2024

This is not a datafaker issue, it is the issue of underlying library https://github.com/mifmif/Generex which was used before 2.2.0

Starting 2.2.0 we use another library https://github.com/curious-odd-man/RgxGen
and it doesn't have this problem
So either bump your dependency or contribute a PR to have similar support in 1.x

@bodiam
Copy link
Contributor

bodiam commented May 24, 2024

Yes to what @snuyanzin said. We don't really support 1.x anymore, nor do we support such old versions of Java, but if you're willing to make a PR for this, I'm happy to release a new 1.x version. But it's recommended to upgrade.

@bodiam bodiam added the waiting for response Waiting for response from the reporter label May 24, 2024
@maxtar
Copy link
Contributor Author

maxtar commented May 24, 2024

I've got it. But Java 11 is LTS. And we counldn't upgrade to new version now.
I will think about PR thank you.

@kingthorin
Copy link
Collaborator

You could just concatenate the pre/post-fix after generating the regexified value.

@maxtar
Copy link
Contributor Author

maxtar commented May 24, 2024

You could just concatenate the pre/post-fix after generating the regexified value.

I did it. But remove prefix and sufffix before calling regexify.

@bodiam
Copy link
Contributor

bodiam commented May 24, 2024

@maxtar It's a bit beyond the scope of this issue, but Java 11 LTS has only but only extended support available, and has been superseded by Java 17 LTS and Java 21, which is also LTS.

Either way, still happy to make a 1.x release when it's fixed.

@bodiam bodiam removed the waiting for response Waiting for response from the reporter label May 25, 2024
@bodiam bodiam added the wontfix This will not be worked on label Jun 1, 2024
@bodiam
Copy link
Contributor

bodiam commented Jun 1, 2024

Hi @maxtar , we're aware of this issue, and as said before, happy to accept PRs, even on the 1.x branch, but for now I'll close the issue to clean things up a little.

@bodiam bodiam closed this as completed Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants