in my application i have a text box in that '123456789v' first 9 charecter must be digits after that any character or a particular character how can i write please help me. thank u
+1
A:
Somthing like:
[0-9]{9}.
Or if the last character must be an alpha character:
[0-9]{9}[a-z]
If you are new to regular expression I sujest you get your hands on a tool to help you with them. I personaly like this Expresso: http://www.ultrapico.com/Expresso.htm but you can also google for a "regex designer" as there a number of good ones online.
Geoff
2009-10-13 06:42:34
ok mr.Geoff it is workin but i need 9 digits and one character should any alphabet thank u for response
Surya sasidhar
2009-10-13 06:56:53
A:
Perhaps something like this may help.
^[0-9]{9}.
EDIT: Removed escape characters.
Rahul
2009-10-13 06:43:38
+1
A:
How about: \d{9}.
Edit: Explained the regex:
\d = Any digit
{9} = 9 times
. = Any character
Scoregraphic
2009-10-13 06:46:48
mr.Scoregraphic it is working when i type 1 to 9 digits after that i type a alphabet it is giving error message
Surya sasidhar
2009-10-13 07:02:12
Please provide some test input/code as it works for me. Best would be to edit the question
Scoregraphic
2009-10-13 07:16:49
A:
I'd say
^\d{9}[A-Za-z]$
To match 9 digits and one alphabetic character, and nothing before or after.
Ledhund
2009-10-13 06:58:37
+1
A:
If the last character must be a alphabet:
^[0-9]{9}[a-zA-Z]$
If the last character can be anything other than a number
^[0-9]{9}[^0-9]$
o.k.w
2009-10-13 07:14:41
A:
Regex r = new Regex("[0-9]{9}[a-zA-Z]$");
label1.Text = r.IsMatch(textBox1.Text).ToString();
If specific character then:
[0-9]{9}v$
NinethSense
2009-10-13 07:27:00