In search of the perfect URL validation regex (2010)
mathiasbynens.be
In search of the perfect URL validation regex (2010)
1–10 of 67 posts
Re: In search of the perfect URL validation regex (2010)
#2After I did this, the interviewer stopped me and told me in a negative way that he expected me to use a regex, which kinda shows he had no idea how a web browser works.
Re: In search of the perfect URL validation regex (2010)
#3I was once failed on a technical interview, partly because on the coding test I was asked to write a url parser "from scratch, the way a browser would do it" and I explained it would take way too long to account for every edge case in the URL RFC but that I could do a quick and dirty approach for common urls. After I did this, the interviewer stopped me and told me in a negative way that he expected me to use a regex…
Unless it was a specific url with specific params?
Re: In search of the perfect URL validation regex (2010)
#4I was once failed on a technical interview, partly because on the coding test I was asked to write a url parser "from scratch, the way a browser would do it" and I explained it would take way too long to account for every edge case in the URL RFC but that I could do a quick and dirty approach for common urls. After I did this, the interviewer stopped me and told me in a negative way that he expected me to use a regex…
Re: In search of the perfect URL validation regex (2010)
#5 @^(https?|ftp)://[^\s/$.?#].[^\s]*$@iS
The simpler the better, if you're going to use something that is not ideal.Re: In search of the perfect URL validation regex (2010)
#6I was once failed on a technical interview, partly because on the coding test I was asked to write a url parser "from scratch, the way a browser would do it" and I explained it would take way too long to account for every edge case in the URL RFC but that I could do a quick and dirty approach for common urls. After I did this, the interviewer stopped me and told me in a negative way that he expected me to use a regex…
Re: In search of the perfect URL validation regex (2010)
#7Well, that should make things a lot easier. What does he mean here? The rest of the text doesn't make it clear to me, unless it's meant to be "every possibly valid HTTP, HTTPS, or FTP URL" which isn't exactly "the opposite".
Re: In search of the perfect URL validation regex (2010)
#8I just discovered this yesterday and I’m glad I didn’t have to come up with this:
https://semver.org/#is-there-a-suggested-regular-expression-...
My use case for it: https://github.com/typesense/typesense-website/blob/25562d02...
Re: In search of the perfect URL validation regex (2010)
#9I was once failed on a technical interview, partly because on the coding test I was asked to write a url parser "from scratch, the way a browser would do it" and I explained it would take way too long to account for every edge case in the URL RFC but that I could do a quick and dirty approach for common urls. After I did this, the interviewer stopped me and told me in a negative way that he expected me to use a regex…
its not very likely this is whats happening here but i feel like this could be done on purpose to see how you act in this kind of situation. it kinda tells how you would act once you inevitably go into a conflict with colleagues arguing over stuff like that.
Re: In search of the perfect URL validation regex (2010)
#10I was once failed on a technical interview, partly because on the coding test I was asked to write a url parser "from scratch, the way a browser would do it" and I explained it would take way too long to account for every edge case in the URL RFC but that I could do a quick and dirty approach for common urls. After I did this, the interviewer stopped me and told me in a negative way that he expected me to use a regex…
how would you even "parse" a url with a regex? dynamically defined named subpatterns for each url parameter? I think the best i could do on paper with a regex is say "yup this is a url" or maybe "yup i can count the number of params" Unless it was a specific url with specific params?