|
-
March 3rd, 2003, 10:01 PM
#1
Problem with Regex
I'm writing the following statement:
string sValue = @"(r11) , ";
string res = Regex.Match(sValue, @"[^,(\s)]+(\s)*,*(\s)*", RegexOptions.Compiled).Value;
Console.WriteLine(res) ;
I wish to get the string "(r11)" without the comma and the spaces.
Yet I get the string "r11" without the parentheses too.
What I'm doing wrong?
-
March 4th, 2003, 03:09 AM
#2
if you know that r11 is a fix then
you could try
string sValue = @"(r11) , (r11) ooioi0w0";
Regex r = new Regex(@"\(r11\)",RegexOptions.Compiled);
MessageBox.Show(r.Match(sValue).Value);
-Paresh
-
March 4th, 2003, 06:54 AM
#3
The idea is to remove the whitespaces and the comma after the expression.
(r11) is only an example
-
March 6th, 2003, 04:50 PM
#4
did you do your homework :-)
-
March 9th, 2003, 06:22 PM
#5
Got your message. Will try to come with less "homework" questions
-
March 10th, 2003, 01:06 PM
#6
u r becoming smarter day by day
hmm
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
|