My Regex Cheatsheet - 25 Example Regex Rules
Tyler Zey🔥 Apr 29
First off, sorry for the clickbait dog photo. I read my title after typing this up and it sounded way to dry. So, I added a cool picture of my dog to spice things up.
...onto the post.
If you're like me, Regex can sometimes elude you. I've been looking for a great course on the topic for almost 6 months now. Just something to make regexr.com actually useful...and not a site where I randomly try strings of code until something MAGICALLY works. 😬
Today, I found that course. And, I'm documenting my lessons here so that hopefully someone else can benefit.
In terms of using these functions, here are the most common js functions:
1) exec() About The Function
- This function returns an array or null. 2) test() About the function
- This function returns true/false if it was found 3) search() About the function
- This function returns the index the search finds the regex at or -1 if it doesn't find anything 4) replace() About the function
- This function returns a new string with the search being replaced.
The best course I found for this was a JS course by Brad Travery on Udemy. Here's the link. I highly recommend it. He covers some great ways to structure your JS files and more.