Click here to Skip to main content
15,884,237 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How would I match anything that matches another match?
For example, if I had a textbox with the text:
"class MyClass1
{
//...
}
new MyClass1()"
and it was matching class names ((?<=class ).*), how would I get it to match all instances of "MyClass1"?
Posted
Comments
Sergey Alexandrovich Kryukov 27-Oct-13 0:34am    
What are you missing? You almost answered your own question.
—SA

1 solution

The question almost contains the answer. Get Match.Value, which is a string, and use it in another Regex's pattern string. Please see:
http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.capture.value.aspx[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900