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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top