how to write a regular expression for like ABCD1234? [closed] - regex

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to set up a rule for a string:
8 chars
first 4 is alphabet, case insensitive.
last 4 is number
how to write a regular expression for this case?

^[a-zA-Z]{4}\d{4}$
Explanation:
^ start of string
[a-zA-Z] the characters a to z and A to Z
{4} repeat the list item 4 times
\d a digit character
{4} repeat the list item 4 times
$ end of string

Related

Regex: check if string corresponding Word numbering list style [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm looking for regex-way to find if a string matches any of this pattern:
2.
1.2
3.4.5
These numbers are taken from the numbering list of Word.
If you only want to match what is above, use ^((\d\.)+\d|(\d\.))$. (Link to regex tester).
This will either match that first kind of pattern (with a digit and then a period) or the other two, which have a digit followed by a period more than 1 time, and another digit at the end.
If you also want to match patterns like 3.4., i.e., strings that may or may not end in a period, you can use ^(\d\.)+\d?$ (Link)
This matches patterns that have a digit followed by a period one or more times, and then maybe a digit after that.

Regex to match letters and digits except 6 digit long number [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Can someone tell me how to allow in Regex all a-zA-Z0-9 except 6 digits long number?
So true for:
1234567
a123456
123456P
3A237bdb8
but false for
123456
I want to
allow only letters and digits
deny 6 digit long number (like 123456) and other not letter characters like -_+,.!##$ etc.
If your regex engine supports lookahead, you can use:
^(?!\d{6}$)[a-zA-Z0-9]+$
Demo

Regex matches string#substring [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am looking for a regex matches any string in the following format:
string#substring -> where substring = substring of the string and string is only letters from a to d
e.g.
abcddd#cd accepted
abcddd#cccc not accepted
This regex should meet your requirements:
[a-d]*?([a-d]+)[a-d]*#\1
It matches abcddd#cd but doesn't match abcddd#cccc.
Depending on your choice of tool and how you use it, you may or may not have to anchor it with a ^ and $ at the beginning and end respectively (turning it into ^[a-d]*?([a-d]+)[a-d]*#\1$).
Experiment here.

Date Range Regex in Notepad++ [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
Looking for a regular expression in Notepad++ to find any years outside of the year range: 1980-2019
This will find WITHIN the year range I'm looking for, but I can't find outside of the range.
[1-9]\d{4,}|19[8,9][0-9]|[1-9]\d{4,}|20[0,1][0-9]
Any help is greatly appreciated!
I don't particularly think regex is suitable for this, but this might work:
(?![1-9]\d{4,}|19[8,9][0-9]|[1-9]\d{4,}|20[0,1][0-9])\b\d+
I simply negated your regex with a negative lookahead, and matched the digits with \d+. This will match any number of digits, because technically the year 1 is also outside of the range 1980-2019. If you only want 4 digit years, simply change + to {4}.

Regex for slash followed by any number [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
What would be the correct way of writing a regex that states:
/ followed by any number
For example, gets fired with "/1", "/2", but not "/a" etc.
PCRE
/\/\d/
this will match any '/' followed by any single character number number.
/\/\d+/
this will match '/' followed by any set of consecutive numbers.
/^\/d+$/
this will match '/' followed by any set of consecutive numbers that are the only thing on that line.