Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Cyanite85578yThat last bit looks like output code from a message encrypter i made a while back xD
-
Root825578y@eldamir the first hyphen? It's within a character set, allowing that set to match a hyphen. It's good to include it as the first char to improve readability a bit. Let me explain by example:
[-a-z0-9&%] matches a hyohen, a-z letters, 0-9 numbers, an ampersand, and a percent.
[a-z0-9&-%] matches the same, but at first glance looks like it matches symbols between & and %, which doesn't make sense. 😛 -
@Cyanite it is not a programming language, it is a regular expression. They can be used on all of those languages, although that one has js sintaxis
-
matanl26478yThis matches a script path of size 2 to 256 with an extension of size 2 to 4, followed by a parameter starting with a /.
The regexp extracts the first param, it actually makes no sense. -
@matanl the \b thing made me curious either. Especially because there is only one. Which doesn't really make sense.
-
eldamir12298y@Ashkin I'd have thought the first hyphen needed to be escaped with \ so it doesn't look like a malformed range. Learn something everyday 🙃
-
matanl26478y@eldamir in scripting languages nothing is malformed if in some alien way it could work, take javascript for example
Related Rants
How the original creator sees their code:
while (true) {
postGuildCount();
}
how contributors see his code :
/[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/
undefined
open-source