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...
·5 min read·amara.hashnode.devUpdated Read the article
Reehan
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?