0
我有一个字符串,它看起来像:正则表达式删除后一切<
some text <a some text "quote" slash..
我想删除一切后,<
所以上面的字符串将导致:
some text
我怎样做那?我需要使用正则表达式吗?
我有一个字符串,它看起来像:正则表达式删除后一切<
some text <a some text "quote" slash..
我想删除一切后,<
所以上面的字符串将导致:
some text
我怎样做那?我需要使用正则表达式吗?
<[^<]+> [^<]*(?<removeGroup><[^<]*)<[^<]+>
使用正则表达式匹配,并通过在比赛中使用“removeGroup”删除不需要的字符串(在.NET)
这是非常简单的,所以你甚至都不需要使用正则表达式来做这个。你可以只用字符串的方法,这里有一个快速的写了在C#:
string str = "some text <a some text \"quote\" slash..";
int index = str.IndexOf("<");
string newstr = str.Substring(0, index);
Console.WriteLine("'{0}'", newstr); // prints 'some text '
看来你的问题失去了一些字符,尝试把“一些文本”的代码块 – 2011-03-10 16:59:42
执行''和' '标签属于你的字符串还是由于格式错误? – 2011-03-10 17:07:51
你使用什么语言? – 2011-03-11 11:14:08