Note: I added the xml declaration, CDATA, and '&' text for testing only.
6
qo'shib qo'ydi 12 Iyun 2013 ichida 01:54 muallif csharptest.net
manba
Ishlar ajoyib! Tnx!
qo'shib qo'ydi 12 Iyun 2013 ichida 04:19, muallif Carl-Otto Kjellkvist, manba
Buning uchun rahmat ... kodingizning bir qismi hozir mening loyihalarimdan birida (albatta, kreditlar bilan)
qo'shib qo'ydi 28 Dekabr 2017 ichida 02:51, muallif Paul Perrick, manba
Bu savol dan bir usuldan foydalaning va kirishning html teglarini olib tashlang
keyin
string output = new string(input.ToCharArray().Where(c=> c=='<'||c=='>').ToArray());
3
qo'shib qo'ydi 09 Iyun 2013 ichida 08:34 muallif Damith
manba
Judging from your example, it seems you are not searching xml files as the subject suggests, but rather XML-like files - perhaps files that would be xml if they did not contain the "<" and ">" characters that you are looking for.
Ammo vazifani etarlicha aniq ko'rsatmadingiz. Masalan, qanday bo'lishi kerak
xxxx
yoki
Ikkinchidan, odatdagi iboralar bilan erishish uchun juda qiyin (ehtimol imkonsiz). Grammatikani yoki siz qabul qilmoqchi bo'lgan kirish tilini (XML kengaytmasini) aniqlab olishingiz va uni recursiv ajralish texnikasi yordamida tahlil qilishingiz kerak.
2
qo'shib qo'ydi 10 Iyun 2013 ichida 12:07 muallif Michael Kay
manba
OK, bu sizning bizga bergan juda yaxshi xususiyatni yozish uchun muammoni yaxshi tushunganingiz kabi eshitiladi.
qo'shib qo'ydi 10 Iyun 2013 ichida 10:09, muallif Michael Kay, manba
Menda mavjud bo'lgan ba'zi bir qo'shimcha teglar bilan birga HTML-sahifa mavjud. Keyin foydalanuvchi "<" va ">" ni qo'shishlari kerak. Shunday qilib, yuqoridagi misollar beparvo emas, 1-misol haqiqiy emas va misol uchun, 2 hisobga olinmaydi.
qo'shib qo'ydi 10 Iyun 2013 ichida 09:22, muallif Carl-Otto Kjellkvist, manba
OK, # 3 tahrirda yanada aniqroq bo'lishga harakat qildim :)
qo'shib qo'ydi 11 Iyun 2013 ichida 08:58, muallif Carl-Otto Kjellkvist, manba
Men sizning savolingizga juda ko'p tushunchani tushunmadim, lekin men sizning HTML namunangizni olgan va HTML natijasini kutilgan HTML natijalari bilan qaytarib beradigan kodni yozdim.
MatchCollection matches = Regex.Matches(YourHTML, @"(?<=<.*?>).+(?=<.*?>)");
foreach (Match match in matches)
{
YourHTML = YourHTML.Replace(match.Value, HttpUtility.HtmlEncode(match.Value));
}
0
qo'shib qo'ydi 11 Iyun 2013 ichida 11:26 muallif a1204773
manba
Given the new formulation of your problem in edit #3, I think you could solve it with a regular expression that matches "<" followed by a negative lookahead
<(?!(/?(a|b|div|p|....|!--|!\[CDATA\[))
which matches < if not followed by one of the known tag-names, and then replace this "<" with "<"
0
qo'shib qo'ydi 12 Iyun 2013 ichida 11:33 muallif Michael Kay
manba
Sizning cheklangan holatlarda sizda ishlaydigan algoritmli strategiya mavjud bo'lib ko'rinadi, bu quyidagicha tavsiflanadi:
Search left to right for an open tag, i.e. .
If found, search the remaining string for the matching close tag,
Recursively repeat steps one and two for the string between the open and close tags just found for as long as you can find matching pairs
For sequences of the string where no open/close tag pair is found, replace all occurrences of < and > with the escapes.
0
qo'shib qo'ydi 11 Iyun 2013 ichida 09:56 muallif 500 - Internal Server Error
manba
Men buni Ahamiyatga bo'ysunmagan deb qo'shishni hohlayman, masalan. u bir xil turdagi ichki teglar bilan to'g'ri ishlamaydi.
qo'shib qo'ydi 11 Iyun 2013 ichida 09:58, muallif 500 - Internal Server Error, manba
static string test(string input)
{
var r = @"(<(.*?)>)(.*?)\2>";
while (Regex.IsMatch(input, r))
input = Regex.Replace(input, r, "$3");
return Regex.Replace(input, @"\w", "");
}
0Bastianon Massimomanba
Html ayrim teglari: