Skip to content
Advertisement

Tag: regex

Removing “,” at the beginning of a line CSV

i want to convert a .csv file and write a new one. However I am not able to remove the first , i am kinda stuck here and it is driving me crazy. This is my code: That’s the output i am getting in the newly generated file Output extractedtasks: Output extractedtasksformated: Answer Because extractedtasks is an array, instead of

regex replace for multiple string array javascript

I have a array of string and the patterns like #number-number anywhere inside a string. Requirements: If the # and single digit number before by hyphen then replace # and add 0. For example, #162-7878 => 162-7878, #12-4598866 => 12-4598866 If the # and two or more digit number before by hyphen then replace remove #. For example, #1-7878 =>

How to match two or more words name in javascript regex?

I’m trying to verify that there are at least two words name, where a word is only alphabet for example: This is the regex I’m currently using just to verify letters and spaces I have searched and tried one of them on this link but it didn’t work link Can anyone help me to verify name more than 1 word?

the right regex for catching a part of url

There are some cases of URLs like below. I need the right regex for catching the “55” or “5” part of those URLs. What I tried was /(?:/category/w+)(/category/)|(d+[^/])/g However, this regex also catches the “3031” in case (3), “30” in case (4). And it cannot catch “5” in cases (2) and (4). How can I fix it to do the

regex works in js but fails in html

I got a regex for matching URIs of YouTube it works well in js but why it fails in html input[pattern] ? Please match the requested format Answer HTML input patterns have an implicit $ at the end, meaning that it expects to match the entire input. You’re not accounting for the &list=RDT4X7Ev7RIZA&index=2, so it’s failing. You can add something

combine regex to match subgroups in different order

I have a string with may have one of the 2 below structure some examples would be The goal is to match as below I can manage to get the result with 3 regex, but not with 1 How can I get the expected result with a single regex ? Answer Maybe use | to separate possible matches: Also note

How to detect regex pattern for strings with underscore

I am trying to create a regex for detecting the number of exact occurance of a string in another string. Here I am getting the exact match for “test” string and nothing else, but it’s ignoring all the “test” strings which have underscore associated with it either front or back(like TEST_UF… or r_test or the regex-test_, the “test” string is

Advertisement