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

Improve the regex finding ip-address-esque content #93

Open
fhightower opened this issue Sep 16, 2022 · 6 comments
Open

Improve the regex finding ip-address-esque content #93

fhightower opened this issue Sep 16, 2022 · 6 comments

Comments

@fhightower
Copy link
Member

We fang anything matching this regex: (?:^|(?<=\s))([0-9]{1,3}),([0-9]{1,3}),([0-9]{1,3}),([0-9]{1,3})(?=\s|$)... we should improve the regex to be more accurate and avoid false positives.

@devbazregari
Copy link

devbazregari commented Sep 16, 2022

what do you mean of " improving " ?!
would you please give me one example with this regexp ?!

@fhightower
Copy link
Member Author

Hi @devbazregari, thanks for asking!

The problem is that the current regex matches more than just valid ip addresses. For example, the current regex would match 999,999,999,999. But we don't want to match 999,999,999,999 because this isn't a valid ip address.

In other words, we want to refine the regex so that it only matches strings which would be valid ip addresses once the , characters are replaced with . characters. Does that help clarify?

You can see more examples of what we do and do not want this regex to match here.

Would you like to work on this? I'm happy to help and advise as needed.

@devbazregari
Copy link

thank you , i got it .

@devbazregari
Copy link

devbazregari commented Sep 19, 2022

bro did my code was usefull?
I passed the test you attached to this website https://regexr.com/6u78s

@fhightower
Copy link
Member Author

fhightower commented Sep 23, 2022

Sorry for the late reply - thank you for the PR! I'll take a look at it soon and will follow up with comments in the PR. Thanks 🎉 !

@devbazregari
Copy link

Ur Welcome

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