regex named captures, are there two similiar syntaxes for this?

  • Thread starter Thread starter DotNetNewbie
  • Start date Start date
D

DotNetNewbie

Hi,

is this the same thing?

string regex = @"(?'tag'.*?)";

and

string regex = @"(?<tag>.*?)";
 
Hi,

is this the same thing?

string regex = @"(?'tag'.*?)";

and

string regex = @"(?<tag>.*?)";

According to the docs, yes:

(?<name>subexpression)
Captures the matched subexpression into a group name or number name. The string used for name must not contain any punctuation and cannot begin with a number. You can use single quotes instead of angle brackets; for example, (?'name').

http://msdn2.microsoft.com/en-us/library/bs2twtah.aspx

Regards,
Gilles.
 

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

Similar Threads


Back
Top