Tuesday, 29 August 2017

Transform a string to a regex in JavaScript

I want a text to be colored when I type "hello", "Hello", "HELLO", ect.. in an input, it works when I use a string but not as a regex




Hello








if(inputValue == "hello" ) works
but
if(inputValue == /hello/i ) doesn't

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...