Regular Expressions in JavaScript.
Regular Expressions, popularly known as Regex, I think gets a bad rep for being tricky or especially difficult to understand or apply. It has been a muse for tech memes, but you don't always have to relate to all of that, this article is here to help...
amara.hashnode.dev5 min read
Hey, firstly, great article!
However, in your regex replace example, I believe something's missing?
Running the following will throw an error:
Uncaught ReferenceError: str is not definedvar heyStr = "Hey now!"; var byeStr = "Bye"; var res = str.replace("Hey", "Bye")//returns ;Shouldn't
res=heyStr.replace("Hey", "Bye")?Similarly, the str.search() example is missing. Let me know if I'm missing something?