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 another character using js (eg with a ?
Tag: regex
JavaScript: How to reduce IFs with REGEX
I’m working on the following function which I had to add a few IFs in case the string was shorter than the format the REGEX groups was expecting: Is there a way to remove the IFs and get the same output with just Regex? I’m looking for something like: complete: 999.999.999-99 partial: 999.999.9 Because the function will be called when
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 matched the /en-CA/ take the remainder of the href
Javascript RegEx to match all whitespaces except between special characters
I need a regEx to match all whitespaces except those inside @ signs to make a correct split. I have this string: With the split I need the following array (with or without @ in 3rd element): With a simple split(” “) I get this: Thank you for your help. Answer You can use See the regex demo. The (?:@[^@]*@|S)+
RegExp logical problem with variables in javascript
we have some checkboxes and When each of the checkes comes true, a value will be added to a single textbox. and when each of the checkes comes false, their own value will be deleted. I hope I explained well. any way… here is my code: I do know that it is not a clean code:) btw ab is my
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 original sentence before the aforementioned string
Regex: How do I match all non letter characters no matter where they are in the string?
I am not sure if there is an elegant solution to this. The regex should only consider letters in a search string and additionally match all other characters no matter where they appear in between the characters of the search string, e.g.: The search string My Moms house should match with the -> <- marked segments: etc. Answer Matching So,
Javascript Regex remove spaces around dash in numbers but not strings
I’m trying to remove spaces around dashes in a string, but only when within numbers: 10 – 89 – 90 should become 10-89-90. But when within a string, they should keep the spaces: A – Z should remain A – Z. As well as 90 – older should stay 90 – older. So only when there are numbers on both
Contents.js blocking page load chrome extension
Hey guys so I’m building an extension but I have a function that is heavy when running and it’s blocking the load of the page and I was wondering if it was possible to only run it after the page is fully loaded and interactive either in the script or in manifest.json? I currently have it inside a window.onload but
Filtering files in directory with regex.match using Puppeteer
I’m having issues with regex.match not matching filenames which do match when I test them individually in an online checker https://regex101.com Can anyone spot the problem in code below? Q: Should I be using regex.test instead of match? If yes, how do I create the regex when it contains variables? It should match all files starting with: ES_(Stay) True –