Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I am struggling with using RegEx to extract the following single letter followed by seven numbers E3285270 from this URL:
http://photos.v3.torontomls.net/Live/photos/FULL/1/270/E3285270.jpg?20150812131646
Could someone please show me what regex string will grab it? Thanks.
You may use word boundaries. \b called word boundaries which matches between a word character and a non-word character.
\b[a-zA-Z]\d{7}\b
In js,
str.match(/\b\[a-z]\d{7}\b/i)[0]
DEMO
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
aa_bb_cc_dd_... (characters with underscores, one or more )
(or)
a1_11_1c_1... (alphanumeric characters with underscores, one or more)
(or)
aaa... (just characters, one or more)
You can try this:
^(?=.*[a-zA-Z])[A-Za-z_0-9]+$
Demo
Edited
If you want to exclude the words which contains only numbers and underscores _ , then try this.
(?![_\d]+\b)\w+
Demo
(?![_\d]+\b) : means to exclude words which is composed of numbers and underscores only.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I need help with Regex to find all words beginning with Denti and remove underscores.
Example:
Denti_Cal_Project_Status
Required Output:
DentiCalProjectStatus
I could use Notepad++.
Anchor the matches to Denti by use of the \G anchor.
(?:\G(?!^)|\bDenti)[^\W_]*\K_See demo and explanation at regex101
\G(?!^) chains matches to a previous match
\K resets beginning of the reported match
[^\W_] is a short for [A-Za-z0-9]
Replace with empty string.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
How would I match the two numbers before the word "min"
Sample string:
15min
I would want to match:
15
Edit:
I've tried matching the pattern, but how do I get the two characters before?
\W*((?i)min(?-i))\W*
Here's a regex that just extracts the first number in the string:
^\D*(\d+).*$
If the number must be in front of min, then you can write it as:
^\D*(\d+)min.*$
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I would like to remove parentheses from a string using a Regex. I see a lot of examples removing numbers or letters but those are not my case.
Thank you all
Try:
s/[()]//g
This is additional text to pass length requirements.
Try
sed 's/[()]//g' file
The regular expression [()] matches a single character which can be a left or right round parenthesis. The sed substitution operator s accepts a flag /g which says to repeat the substitution for every occurrence on each input line.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
How to match only the spaces(not the strings) that is within double quotes and rest of the spaces must be ignored , the following regex \s(?=\") will select the only the space which is before a double quote so i was thinking there would be some sort of regex to match the space only with in double quotes
The below regex would matches the spaces which are present inside the double quotes,
\s(?!(?:[^"]*"[^"]*")*[^"]*$)
DEMO