Regex Indexer Question.

  • Thread starter Thread starter Ben Dewey
  • Start date Start date
B

Ben Dewey

I am trying to get the parts of a regular expression. This is a simplified
version of what I am trying to do.

expression:
((\w)+)

source:
something

results:
$1 = something
$2 = g

Is there any way to get an indexer for $2. For example $2.4 or $2(4) would
get me the fourth letter.
 
Ben Dewey said:
I am trying to get the parts of a regular expression. This is a simplified
version of what I am trying to do.

expression:
((\w)+)

source:
something

results:
$1 = something
$2 = g

Is there any way to get an indexer for $2. For example $2.4 or $2(4)
would get me the fourth letter.

Look at the documentation for Group.Captures: I think it does exactly what
you want.

Niki
 
Back
Top