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
 

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