It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Hi I want a regular expression that will just allow ONE letter(which can be any from A-Z in upper or lower case and then ONE numeric between(1-9)
Correct values are
T5
e3
k8
Z2
Incorrect Values are
Aa1
12
aa
rr
4r
1w
Thanks.
you should explore regex before asking this question quick tutorial
by the way this regex works for you
^[a-zA-Z][1-9]$
^ for start of string
$ for end of string
you can use according to your need
try use this regex \b[a-zA-Z][1-9]\b
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I want to validate a text box (with max length 2) to contain only these 3 set of values.
(i) 00-99
(ii) Q
(iii) DQ
Invalid values are 1Q, 2D, QD, QQ, DD,etc etc
Alright you can use the following it will check for what you asked for its very simple and primitive regix but will work:
\d{2}|DQ|Q
If you want to better understand regular expressions the following might help:
http://msdn.microsoft.com/en-us/library/az24scfc.aspx
You can also use:
http://myregextester.com/index.php
As a tool to test your regix.
Hope that helps
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
For example the desired Regex would successfully match "areriroru" but wouldn't match "sadwdij" which contains just two of the vowels.
In C#, you can use lookahead assertions for each vowel before matching the string with .*:
(?=.*a)(?=.*e)(?=.*i)(?=.*o)(?=.*u).*
If you don't care about the case of your vowels, you could use this:
(?=.*[Aa])(?=.*[Ee])(?=.*[Ii])(?=.*[Oo])(?=.*[Uu]).*
One possibility is enumerating all the permutations of the vowels. Here are the first 24 of 120 total (all the ones where a is the first vowel). Note that this forms one long expression, but I split it into lines here for clarity.
a.*e.*i.*o.*u
|a.*e.*i.*u.*o
|a.*e.*o.*i.*u
|a.*e.*o.*u.*i
|a.*e.*u.*i.*o
|a.*e.*u.*o.*i
|a.*i.*e.*o.*u
|a.*i.*e.*u.*o
|a.*i.*o.*e.*u
|a.*i.*o.*u.*e
|a.*i.*u.*e.*o
|a.*i.*u.*o.*e
|a.*o.*e.*i.*u
|a.*o.*e.*u.*i
|a.*o.*i.*e.*u
|a.*o.*i.*u.*e
|a.*o.*u.*e.*i
|a.*o.*u.*i.*e
|a.*u.*e.*i.*o
|a.*u.*e.*o.*i
|a.*u.*i.*e.*o
|a.*u.*i.*o.*e
|a.*u.*o.*e.*i
|a.*u.*o.*i.*e
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
As part of my assignment I have to replace words with at least one numeric with the word STOP, Is there any way of doing it using regex?
Words
a1wew
abc
1rr
sd
Output
STOP
abc
STOP
sd
I am using regex of eclipse in find.
Find:
(?=.*\d)\w+
Replace:
STOP
One possible regex is grep '.*[0-9].*'
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
\\s*[\\-]?[\\d]{1,3}\\s+[\\-]?[\\d]{1,3}\\s+[\\-]?[\\d]{1,3}\\s+[\\-]?[\\d]{1,3}\\s*
I have this regex for taking in 4 coordinates which are whole numbers (positive or negative). Can you please suggest any bugs in this regex?
If it's a Java regex, then it's correct for matching a string that contains four integer numbers between -999 and 999, separated by whitespace. It's very ugly, though, and could be simplified a lot:
\\s*(?:-?\\d{1,3}\\s+){3}-?\\d{1,3}\\s*
If it's not Java, then you only need one backslash at a time (but you might need other syntax, depending on your language).
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have a excel file that must have this name format, where xxx is a number and yymmdd is a date. Only xxx and yymmdd change, the rest is always the same.
CDFSDDRCxxxCurryymmdd.xls
What is a regex I can use to check if it is correct??
Try with following regex:
^CDFSDDRC\d{3}Curr\d{6}\.xls$
In C# I think you can try something like this :
"CDFSDDRC(?<xxx>[0-9]+)Curr(?<yymmdd>[0-9][0-9][0|1][0-9][0-3][0-9])\.xls"
But you will have to check matches.Groups["yymmdd"].value once more to check for special cases such as CDFSDDRC123Curr321539.xls that match but contains an incorrect date.
I think the following should work.
CDFSDDRC\d[3]Curr(([0-9]{2}(0[13578]|1[02])(0[1-9]|[12][0-9]|3[01]))|([0-9]{2}(0[469]|1[1])(0[1-9]|[12][0-9]|30))|([0-9]{2}(02)(0[1-9]|1[0-9]|2[0-8]))|((((04|08|[2468][048]|[13579][26]))|00)(02)29))\.xsl
I think that you have to escape the backslashes in the C# string.
"CDFSDDRC\\d[3]Curr(([0-9]{2}(0[13578]|1[02])(0[1-9]|[12][0-9]|3[01]))|([0-9]{2}(0[469]|1[1])(0[1-9]|[12][0-9]|30))|([0-9]{2}(02)(0[1-9]|1[0-9]|2[0-8]))|((((04|08|[2468][048]|[13579][26]))|00)(02)29))\\.xsl"