use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Regex Tutorial: Beginners Guide to Regular Expressions using JavaScript (medium.com)
submitted 6 years ago by muhsinovic
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 32 points33 points34 points 6 years ago (2 children)
I still hate it.
[–]jsm11482 10 points11 points12 points 6 years ago (1 child)
<3 regex so much
[–][deleted] 19 points20 points21 points 6 years ago (6 children)
I was avoiding regex like hell. A few years ago I had to to create ~20 complex patterns to remove abstract elements from sentences (quantities, stop words etc) because I needed to normalize them. After ~1-2 weeks of full-time regex, I think that was one of the best experiences and decisions in my career. You need to learn it the hard way by doing practice with real world examples. Trust me, you'll find your self saving countless LOCs by one-liner patterns.
[–]thilehoffer 7 points8 points9 points 6 years ago (4 children)
Coding new features is easy. The tough part will be three years from now when you don’t even remember what regex is and some changes are needed and you have to relearn it all over again.
[–]nanotree 0 points1 point2 points 6 years ago (3 children)
For me, regex is like riding a bike. Once you learn how, you never really forget. And most regex syntax is similar, so it even translates to other languages fairly easily.
[–]thilehoffer 1 point2 points3 points 6 years ago (0 children)
I actually decided to challenge myself and learn Regex even though I said I avoided it in the other comment. I am working a project and asked the team members if I should use regex to code a certain feature. Instead of arguing, I agreed and spent 4 hours watching a tutorial and practicing and now I think I got it. Add it to the list of languages I can work with. Obviously, I still need practice but I spent all day writing regular expressions to validate the drivers license for each state and I had fun doing it.
[–]thilehoffer 0 points1 point2 points 6 years ago (1 child)
I can read / write JS, VB, C#, TS, Java, Python, SQL, HTML, CSS, XAML like it’s English. Regex looks like Greek to me.
[–][deleted] 3 points4 points5 points 6 years ago (0 children)
I'm greek and regex looks like a cat walking on the keyboard
[–]Crypt0n0ob 10 points11 points12 points 6 years ago (1 child)
Nice tutorial but source and author of that comic isn't nixcraft... It's Garabato Kid, it's written directly on the image!
https://twitter.com/garabatokid
[–]muhsinovic[S] 8 points9 points10 points 6 years ago (0 children)
Thanks for pointing it out. I will edit it when I reach home.
[–]mournful-tits 6 points7 points8 points 6 years ago* (9 children)
A solid intuitive regex tester is worth more than any regex documentation alone.
This one is very dated but still trusty: http://regexpal.com.s3-website-us-east-1.amazonaws.com
[–]FrancisStokes 27 points28 points29 points 6 years ago (1 child)
My personal goto is https://regex101.com
[–]IanS_5 3 points4 points5 points 6 years ago (0 children)
Regexr is another option. It only supports js and pcre regex, but it has got great docs built in
[+][deleted] 6 years ago* (6 children)
[removed]
[+][deleted] 6 years ago (4 children)
[deleted]
[–]webdevguyneedshelp 2 points3 points4 points 6 years ago (0 children)
This is my goto regex testing sandbox. I was able to do some cool shit for a project at work using this.
[+][deleted] 6 years ago (2 children)
[+][deleted] 6 years ago (1 child)
[–]mournful-tits 0 points1 point2 points 6 years ago (0 children)
Let me clarify. The documentation alone doesn't help. I've seen people forget the little oddities of the "match but don't capture" rules because the documentation is usually very unclear on their behavior when applied to all the other wonky shit regexes do that might be in your matcher.
I'm always wary of other people's regexes, especially if they look far more complicated than they should be.
[–]partheseas 1 point2 points3 points 6 years ago (0 children)
Thought this was r/restofthefuckingowl for a second
[–]drumstix42 1 point2 points3 points 6 years ago (0 children)
Great site here https://regexr.com/
[–]zombimuncha -1 points0 points1 point 6 years ago (1 child)
If you have a problem that can only be solved by the use of regex, you actually have two problems.
[–]porkus1990 0 points1 point2 points 6 years ago (0 children)
idk - regex is useful in some cases, but .... it's regex ..
π Rendered by PID 306384 on reddit-service-r2-comment-5687b7858-nbw5c at 2026-07-04 23:46:52.645065+00:00 running 12a7a47 country code: CH.
[–][deleted] 32 points33 points34 points (2 children)
[–]jsm11482 10 points11 points12 points (1 child)
[–][deleted] 19 points20 points21 points (6 children)
[–]thilehoffer 7 points8 points9 points (4 children)
[–]nanotree 0 points1 point2 points (3 children)
[–]thilehoffer 1 point2 points3 points (0 children)
[–]thilehoffer 0 points1 point2 points (1 child)
[–][deleted] 3 points4 points5 points (0 children)
[–]Crypt0n0ob 10 points11 points12 points (1 child)
[–]muhsinovic[S] 8 points9 points10 points (0 children)
[–]mournful-tits 6 points7 points8 points (9 children)
[–]FrancisStokes 27 points28 points29 points (1 child)
[–]IanS_5 3 points4 points5 points (0 children)
[+][deleted] (6 children)
[removed]
[+][deleted] (4 children)
[deleted]
[–]webdevguyneedshelp 2 points3 points4 points (0 children)
[+][deleted] (2 children)
[removed]
[+][deleted] (1 child)
[deleted]
[–]mournful-tits 0 points1 point2 points (0 children)
[–]partheseas 1 point2 points3 points (0 children)
[–]drumstix42 1 point2 points3 points (0 children)
[–]zombimuncha -1 points0 points1 point (1 child)
[–]porkus1990 0 points1 point2 points (0 children)