469,625 Members | 1,859 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,625 developers. It's quick & easy.

Function matchevaluator in Regex.Replace

Dear all,

I'd like to do something which is easy in Jscript, but I can't figure
it out how to do it in c#.

In javascript I can put an function inside an regex Replace like this:
var a="<td width=100>";
str.replace(/(\w+=)(\w+)(?=[ >])/mgi,"$1\"$2\"")})
// unquoted attributes get quoted, eg: width=100 ==> width="100"

but in c#:
public string mFunc(Match m){return "bla bla bla blabla"; } // not
string a="<td width=100";
RegexOptions regOpts= RegexOptions.IgnoreCase |
a = Regex.Replace(a,@"<[a-z]+([^>])*>",new

The javascript method to actually include the function into the
replace fancies me, but how to do this in c#?

In other words:
how to use an MatchEvaluator as provided in the javascript example?
Thanks in advance,


Nov 15 '05 #1
0 1531

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Craig Kenisston | last post: by
6 posts views Thread by tshad | last post: by
15 posts views Thread by morleyc | last post: by
reply views Thread by Karch | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.