|
-
March 7th, 2011, 04:41 PM
#1
Regular expression pattern
Hi, I want to write a pattern like this, plase correct it.
Code:
string key = "something";
string pattern = key + "[^\\d]+.*";
return Regex.IsMatch(string_value, pattern);
I don't know how to add "@".
Thanks.
-
March 8th, 2011, 12:57 AM
#2
Re: Regular expression pattern
So you want to match a pattern that starts with "something", contains at least one character that is NOT a digit (and the @ sign?) and then matches the rest of the string?
If so, you are within a heartbeat of the solution:
Code:
string key = "something";
string pattern = key + "[^\\d@]+.*"; //Change this line
return Regex.IsMatch(string_value, pattern);
Otherwise, I don't understand your question. Could you be more clear about what you want to do?
Best Regards,
BioPhysEngr
http://blog.biophysengr.net
--
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.
-
March 8th, 2011, 08:56 AM
#3
Re: Regular expression pattern
I mean
Code:
string pattern = key + "[^\\d]+.*";
or
Code:
string pattern = key + @"[^\\d]+.*";
or
Code:
string pattern = key + @"[^\d]+.*";
I want to match a pattern that starts with "something", contains at least one character that is NOT a digit and then matches anything.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|