There’s new RegExp(string, flags)
where flags
are g
or i
. So
'GODzilla'.replace( new RegExp('god', 'i'), '' )
evaluates to
zilla
More Related Contents:
- Find particular string from URL in JavaScript
- Negative lookbehind equivalent in JavaScript
- Case insensitive regex in JavaScript
- Remove not alphanumeric characters from string
- Count number of matches of a regex in Javascript
- Password REGEX with min 6 chars, at least one letter and one number and may contain special characters
- Regex created via new RegExp(myString) not working (backslashes)
- Replace a Regex capture group with uppercase in Javascript
- How to parse a URL?
- List of all characters that should be escaped before put in to RegEx?
- Match any non-word character (excluding diacritics)
- How can I select an element by ID with jQuery using regex?
- Regex to Match Symbols: !$%^&*()_+|~-=`{}[]:”;’?,./
- Javascript regex returning true.. then false.. then true.. etc [duplicate]
- Regex to replace everything except numbers and a decimal point
- Can I use a regular expression in querySelectorAll?
- In a regular expression, match one thing or another, or both
- Regex remove repeated characters from a string by javascript
- (*SKIP)(*FAIL) workaround in JavaScript RegExp
- What are non-word boundary in regex (\B), compared to word-boundary?
- What is the need for caret (^) and dollar symbol ($) in regular expression?
- Replacing accented characters with plain ascii ones [duplicate]
- Best way to parse HTML in Javascript
- How to insert space every 4 characters for IBAN registering?
- JavaScript Regex to match a URL in a field of text
- Regular Expression Pattern With A Variable
- RegEx Ignore Case
- Regex that matches anything except for all whitespace
- How to properly escape characters in regexp
- How to loop all the elements that match the regex?