Regex to allow character and two operators [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 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

Related

regex to validate string of 10 characters which are all digits [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
I want to match a string of 10 characters and all of them need to be integers. How do I write a regular expression to check for this format.
Valid values should be something like - '1234567890', '4321567890'
The easiest (not all dialects support this):
[0-9]{10}
Another option:
[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]
If you match the whole string, don't forget the ^ and $ markers:
^[0-9]{10}$

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 rising digits [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 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.

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.