this post was submitted on 10 Oct 2023
15 points (100.0% liked)

JavaScript

2403 readers
1 users here now

founded 2 years ago
MODERATORS
 

I am currently trying to learn Javascript and am getting hung up trying to understand Regex. Does anyone have any good resources or recommendations for me?

top 7 comments
sorted by: hot top controversial new old
[–] AVeryCleverName@lemmy.one 14 points 2 years ago (1 children)
[–] autokludge@programming.dev 3 points 2 years ago

also sometimes handy to show railroad diagram to help visualize the pattern.

[–] Ategon@programming.dev 6 points 2 years ago* (last edited 2 years ago)

regex101 is great for building up regex expressions

weve also got a regex community in the instance at !regex@programming.dev with some stuff in it

[–] CameronDev@programming.dev 4 points 2 years ago

This isnt really a resource as such, but an interesting game that effectively nerdsniped my whole team:

https://rampion.github.io/RegHex/

[–] Sparrow_1029@programming.dev 4 points 2 years ago

https://regexlearn.com/ is interactive to get you started.

Then try reading maybe the python regex docs for more detailed info. There are multiple flavors of regex as well, which makes it even more confusing (yay), but you'll eventually grok it enough to make it a part of your toolbox! I use simple regex frequently for search/replace (VScode or vim), and in the shell.

For more complex string parsing operations, there's often a faster/better method than regex, but it's really good to know.

[–] lobut@lemmy.ca 1 points 2 years ago

If you like videos then I think this video is quite decent: https://youtu.be/rhzKDrUiJVk?si=UUfyL5ua7FGnGJsL

[–] Paragone@programming.dev 1 points 2 years ago

I just discovered that Exercism.org doesn't have a regex track...

Well, I'll be...

: )