471,330 Members | 1,588 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

Regex help, modifying the value before doing the replacement


I have a regex and I want to modify the value of a named capture
before doing the regex.Replace.

So something like:

string text = Regex.Replace(oldText, myRegex, @"<a href="$1">$1</a>",

Now I want to modify the value of the second $1 just in case it is too
long to display.

This doesn't work, but this is what I want to do somehow!

string text = Regex.Replace(oldText, myRegex,
String.Format(@"<a href="$1">{0}</a>",
Jun 27 '08 #1
0 630

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Just Me | last post: by
2 posts views Thread by Art | last post: by
2 posts views Thread by Alex Maghen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.