C
Christoph Boget
I'm trying to grab everything between the square brackets
and this code just isn't working. I'm not sure what's going
on. I've tested the regular expression elsewhere and it works
as expected. Just not in my C# code...
Regex oRegex = new Regex( @"\[([\S\s]+)\]" );
string sSelectedItem = "[joe#bob!briggs@9]";
Match oMatch = oRegex.Match( sSelectedItem );
if( oMatch.Success ) {
MessageBox.Show( "Matched! Value is " + oMatch.Value );
sSelectedItem = oMatch.Value;
}
MessageBox.Show( "You just selected " + sSelectedItem );
What am I doing wrong?
and this code just isn't working. I'm not sure what's going
on. I've tested the regular expression elsewhere and it works
as expected. Just not in my C# code...
Regex oRegex = new Regex( @"\[([\S\s]+)\]" );
string sSelectedItem = "[joe#bob!briggs@9]";
Match oMatch = oRegex.Match( sSelectedItem );
if( oMatch.Success ) {
MessageBox.Show( "Matched! Value is " + oMatch.Value );
sSelectedItem = oMatch.Value;
}
MessageBox.Show( "You just selected " + sSelectedItem );
What am I doing wrong?