2つのURLに一致する必要があります。最初のものはMySQLデータベースから来ており、2番目のものはHtmlページからのものです。私は、文字列c#Htmlの特殊文字に一致しません
var match = Regex.Match(href.Attributes["href"].Value, testString, RegexOptions.IgnoreCase);
match.Success = false.
両方の文字列がthis : myUrl/rollcontainer-weiß
に似ていますがmatch.Successはまだ偽であるとしても比較する場合。
HttpUtility.HtmlEncode
を追加して両方の文字列を確認しようとしました。最初の文字はmyUrl/rollcontainer-weié
、もう1文字はmyUrl/rollcontainer-wei&ß
です。
この場合、match.Success = true
はどうすればよいですか?
この回答はどうですか(http://stackoverflow.com/a/18331804) –
Uri.Compareを使用すると-1が返されます。 – Gun
'var match = Regex.Match(href.Attributes [" href "])を試してください。値、Regex.Escape(HttpUtility.HtmlDecode(testString))、RegexOptions.IgnoreCase);' –