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.*$
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 7 days ago.
Improve this question
https://regex101.com/r/hntg9i/1
like for +43 and +49 a working regex, mine is not working
In my regex the numbers are also matched and not only just the telephone numbers.
Has anyone a solution to that?
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 2 years ago.
Improve this question
In Ruby, I want to see if user input contains any letter in the alphabet.
I have tried using contains and include?, but neither of these worked.
See String#include?
For example:
myString.include? 'a'
Similar to the comment from Cary: use a regular expression (regexp):
puts ‘matches’ if in_str =~ /[A-Za-z]/
See also: https://ruby-doc.org/core-2.7.1/Regexp.html
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 3 years ago.
Improve this question
I can't figure out a way to pull out two numbers in a string and save them in a different variable in classic asp.
The string is:
"\1800_411.pdf.log"
All I was trying to do is to save the first number which is 1800 in a variable and save the 411 in a different variable
What about:
(\d+)_(\d+)
This would save them into two capturing groups. See here: https://regex101.com/r/v83Zbt/1
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 was trying to solve this by myself but there are only solutions for cases like that:
"text" "text2" "text3"
I need to write a pattern which takes strings starting with '-' sign, expected result is shown below:
Input:
-something/3443/kk-somethingelse/111/333/zz
-text/ff/33/33/zz
Output:
1. something/3443/kk
2. somethingelse/111/333/zz
3. text/ff/33/33/zz
as individual grups.
Thanks in advance and sorry I couldnt manage that.
Try this pattern, with global flag:
-([^-\s]+)
Demo link
I would exclude line breaks as well:
-([^-\r\n]+)
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