hmm, reg exp prob again

  • Thread starter Thread starter Lasse Edsvik
  • Start date Start date
L

Lasse Edsvik

Hello

why doesn't this match everything after first space?

Match m = Regex.Match(@"/great ba b4",@"Zs:+");

/Lasse
 
Hello

why doesn't this match everything after first space?

Match m = Regex.Match(@"/great ba b4",@"Zs:+");

Lasse,

"Zs" is not a valid regular expression to match a space. To match a
Unicode space, the correct regex is \p{Zs}.


Match m = Regex.Match(@"/great ba b4", @"\p{Zs}(?<match>.*)");

// Use the named-capture group to get the result (ba b4).
Console.WriteLine(m.Groups["match"].ToString());


Hope this helps.

Chris.
 
Back
Top