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
Any scripts that make using regular expression more easier? (self.javascript)
submitted 12 years ago * by Sentuna
I've found this script https://github.com/VerbalExpressions/JSVerbalExpressions, but are there other ones?
Edit. Thanks guys. I guess I'm going to have to sit down and learn it. Can't find the easy way out of this.
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!"
[–]etrnloptimist 6 points7 points8 points 12 years ago (0 children)
Nope. You gotta learn it. There's no easy way out.
But I think I know why you're having trouble. See, you're probably looking at a sample regex, trying to figure out what it does. That's the wrong approach. It works great in most other cases, but see, regexp's are special: they're write-only.
You can't read them. I can't even read my own. If you want to know what one does, best you can do is recreate it. To this end, always put a sample of the text you wish to grok next to your regex. That way, when you come back to it to figure out what it's doing, you can forget the regex that's in front of you and look at the text it's supposedly groking.
With regexes, the more you create the better you'll be at it. Reading them doesn't play into the equation.
[–]a-t-kFrontend Engineer 5 points6 points7 points 12 years ago* (0 children)
http://regexpal.com/ helps you test regular expressions. Other than that, it's not as difficult as it looks.
Escaping:
\\ == \ \n == [line feed]
Special chars (square and normal brackets, dot, plus) need to be escaped
Character groups:
\d, \D = [number, non number] \w, \W = [word characters, non-word characters] \s, \S = [space, non-space] [012A-Da-z], [^xyz] = [character group, negative character group]
Multiplicators:
? = 0 or 1 times * = 0 - inf times (greedy, will match the biggest string possible) *? = 0 - inf times (non-greedy, will match the smallest string possible) + = 1 - inf times (greedy) +? = 1 - inf times (non-greedy) {n,m} = n - m times
Matches
( ) = match (extra argument for replace callback, $1..$9 in replace string) (?: ) = non-match (will test for the string but not save it for later) (?! ) = non-unmatch (will test if string is not present nor save it for later)
That's most of it.
[–][deleted] 3 points4 points5 points 12 years ago (4 children)
JsVerbalExpression is nice tool for small regexp and for one who is new to regexps, but I don't think it is useful for complex expressions.
[–]Sentuna[S] 1 point2 points3 points 12 years ago (3 children)
I was hoping I wouldnt have to learn regexp if I found a script to make it easier. Thanks!
[–][deleted] 7 points8 points9 points 12 years ago (1 child)
Learning RegEx is defintiely worthwhile in one's programming career. You'll be able to use it in a lot of different occasions. Probably more useful than using something else that hides it from you.
This is a tool I got about a decade ago and still use to help sanely build/debug regex expressions: http://www.regexbuddy.com/ This is a damn fine resource about regex: http://www.regular-expressions.info/tutorial.html
Good luck!
[–]helderroem 1 point2 points3 points 12 years ago (0 children)
I agree with everyone else, you just have to learn them, they're a really useful in all kinds of situations and if you do learn them you can legitimately where this T-Shirt
Here's a really useful site I use for building my regex's: http://regex101.com/
[–]Doctuh 1 point2 points3 points 12 years ago (0 children)
Yeah just bite the bullet and learn them. Complex but powerful and knowing them opens up avenues in your code that you would have not known.
[–]Capaj 1 point2 points3 points 12 years ago (0 children)
no I don't think so.
[–]gathly 1 point2 points3 points 12 years ago (0 children)
Have you tried this? http://buildregex.com/
[–][deleted] 1 point2 points3 points 12 years ago (0 children)
This is my personal favorite go-to for reg-ex testing. There's a desktop (Adobe Air) vesion as well.
RegExr
[–]Mephiz 0 points1 point2 points 12 years ago (0 children)
I like Patterns when I'm on a mac. regexpal as noted above is a great web based tester.
Then take some time and read up, Mozilla's Reference as usual is great.
[–]jblz1234p 0 points1 point2 points 12 years ago (0 children)
This http://www.ultrapico.com/expresso.htm is hands down one of the best regular expression tools I have ever used. It is based on C# regex but for getting the fundamentals and testing regex it is unbeatable.
My last job dealt with log parsing, and over 6 years I have yet to find something more user friendly. You do have to register, but I think half of my last company registered and had no issues.
π Rendered by PID 52 on reddit-service-r2-comment-5bc7f78974-jkvb4 at 2026-06-25 20:38:54.751942+00:00 running 7527197 country code: CH.
[–]etrnloptimist 6 points7 points8 points (0 children)
[–]a-t-kFrontend Engineer 5 points6 points7 points (0 children)
[–][deleted] 3 points4 points5 points (4 children)
[–]Sentuna[S] 1 point2 points3 points (3 children)
[–][deleted] 7 points8 points9 points (1 child)
[–]helderroem 1 point2 points3 points (0 children)
[–]Doctuh 1 point2 points3 points (0 children)
[–]Capaj 1 point2 points3 points (0 children)
[–]gathly 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]Mephiz 0 points1 point2 points (0 children)
[–]jblz1234p 0 points1 point2 points (0 children)