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

JavaScript

1961 readers
1 users here now

founded 1 year 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?

you are viewing a single comment's thread
view the rest of the comments
[–] thisisnotgoingwell 1 points 1 year ago

There's a lot of great resources others have given, but as an overview, regex is kind of a mini language for Natural Language Processing. If you work in any kind of field where you have to work with unstructured data that contains things like phone numbers, names, IPs, hostnames, DNS records, etc, it's a very powerful skill to have. Regex is for the most part largely the same across different languages, so if you learn regex for Python or JS or Perl it's largely the same.

The power comes from using regex meta characters. You'll have to look them up a lot to remember what they each do... You will probably have to reference a meta character guide pretty often at first, so it might be a good idea to print out a cheat sheet.

Learning regex was the start, for me, of being able to write applications that could easily be reused.