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>";
a=a.replace(/<[a-z]+([^>])*>/mgi,function(str,p1,off,s){return
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
important
string a="<td width=100";
RegexOptions regOpts= RegexOptions.IgnoreCase |
RegexOptions.Multiline;
a = Regex.Replace(a,@"<[a-z]+([^>])*>",new
MatchEvaluator(this.mFunc),regOpts)
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,
Greetz,
Joord