Skip to content

Tag: regex

Regex – Replace quote in quotes

The following regex pattern finds the a single double quote in the following string examples (basically the double quote after the 1). The problem is that the positive lookbehind is not supported in some browsers. Is there an alternative regex pattern that would work? I need to replace this double quote with …

Javascript get the value of an href after a certain pattern

I have a url like https://www.whatever.com/en-CA/something I want to capture anything that comes after the en-CA/ (the en-CA can be any combination of characters that have two letters, a dash, and two letters. I am trying to use a regex to grab the window.location.href split the href at the pattern that match…

Regex to match string in a sentence

I am trying to find a strictly declared string in a sentence, the thread says: Find the position of the string “ten” within a sentence, without using the exact string directly (this can be avoided in many ways using just a bit of RegEx). Print as many spaces as there were characters in the origina…