Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am writing regex to match the pattern like this.
abc:123-12-4
abc: It should be exact match including colon
123 Number match any length
- Exact Match
12 Number Match any length
- Exact match
4 Exact match
Any ideas how it can be done in a simpler way.
You can use this regex:
^abc:[0-9]+-[0-9]+-4$
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
Any help would be greatly appreciated. I need to create a regex that will allow any four digits except ones that start with "88" or "89"
You can use this negative lookahead based regex:
^(?!8[89])[0-9]{4}$
Read more about it
Consider the following Regex...
(8[\d-[89]]{1}|[\d-[8]]{1}\d)\d{2}
Edit:
Explanation:
Select from two alternatives:
8[\d-[89]]{1} : 8 followed by any digit except 8 and 9
[\d-[8]]{1}\d : Any digit except 8 followed by any digit
And
\d{2} - Any digit, exactly 2 repetitions
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
I aw trying to write a regular expression that allows only 3 or 4 alphanumeric and will also allow % and *, which can be used with the alphabets.
ex: abc* or abc% some thing like this.
You can use this regex:
^[a-zA-Z0-9*%]{4,5}$
Regex Explanation:
^ - Line start
[a-zA-Z0-9*%] - Alphanumeric (letters or digits) OR * OR %
{4,5} - 4 or 5 of those
$ - Line end
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need a regular expression to only match rising numbers.
ex: 22335566 66678
but not: 444663 33997777666664
the length of the number is not fixed nor is the starting digit.
Any help please?
The best way to implement this using regex is:
^(?=\d)1*2*3*4*5*6*7*8*9*$
The regex matches:
0 or more 1's, followed by,
0 or more 2's, followed by,
0 or more 3's... and so on.
(?=\d) ensures that there is atleast 1 digit in your string.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
What is the most efficient way with regex to match:
test
test case
tester
The last one should not match.
Use a word boundary:
/test\b/
This means that the word must end after test.
\btest\b
\b is the word boundary anchor.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am trying to come up with Reg ex expression that would match an email address starting with format E- and replacing the "AT" with an actual "#" sign.
Here is an example:
E-CANAD.JACK AT EXAMPLE.COM.
The desired output will need to look like CANAD.JACK#EXAMPLE.COM.
Replace:
[eE]-([a-zA-Z0-9]+(?:[._-][a-zA-Z0-9]+)*) (?:at|AT) ([a-zA-Z0-9]+(?:[._-][a-zA-Z0-9]+)*[.][a-zA-Z]+)
By:
$1#$2
More:
Visualization by
Debuggex
Demo by RegExr
You didn't mention your language, so I'm assuming perl
s/^E-(.*) AT (.*)$/$1\#$2/;