Regex rising digits [closed] - regex

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.

Related

Regex to match colon and numbers [closed]

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$

Regex for any four digits except starting with 88 or 89 [closed]

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

Regex to allow character and two operators [closed]

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

Regex Binary multiple of 4 [closed]

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
How can I write a Reg-ex Expression to check whether a string is a binary multiple of 4? I am not good at making DFA and finding expressions.
A multiple of 4 in binary is any binary number that ends with 00, so this regexp should do it:
^(?:[10]*00|00?)$
If you mean a multiple of 4 in decimal, I wouldn't do that with a regexp, except perhaps to verify that it's a number. Then I'd parse it and check whether number % 4 is zero.

Regex: match X pattern but not Y [closed]

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.