Skip to content

Tag: regex

How do I combine these three regex into one?

I’m trying to make a regular expression that only accepts: Min 100 and atleast 1000 characters, characters “,’,<,> aren’t allowed, two full stops one after another aren’t allowed. This is what I have for now: ^.{100,1000}$ → for 100 to 1000 characters ^[^”‘<>]*$ → for…

Regexpr with a string

I have to get the result from this regular expression; the regular expression is a string in a variable: but the xlslHrefRegExpResult variable is null. If I use: without the string variable containing the expression, the result is achieved. Where is the error using a string to build the regexp? Answer The cor…

Whats wrong with this regex to remove substring?

Trying to strip out the extra addressee from an address string. In the example below, dba bobs is the targeted string to remove. The above yields: When the desired is: What am I doing wrong? Sometimes the input has a ‘n’ before the ‘dba’. Answer You can simplify your regex to: /b(attn|…

Regex limit the number of letters total in the entire string

I have this expression which is almost what I need: except, I need to only allow 4 letters total (4 in the beginning and 0 in the end,3 and 1, 2 and 2, 0 and 4, etc…) allowed inputs: 11abcd11 1abcdefg123 abcd1234 unallowed inputs: 1abcd11 abcd123 1abcd12 is there a way to achieve this? thanks! Answer To…

node – How to replace part of an url

I have an array of urls like this: I need to search inside it to match the user input with the subdomain part of the url, I’m trying with thism line of code to achive it: If the input is find, I need to replace the second part of the url, in my case /foo-bar with /foo-baz or /foo-baz-bar to