Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要在字符串中替换所有不以“}”开头的“<输入>”类型的表达式。哪个是正确的正则表达式?
例子
strTest = "{ text string }<input> text<input>"; strRegex = ;//which value? strResult = Regex.Replace(strTest, strRegex , "");
strResult 应该返回
{ text string }<input> text
你可能想要消极的回顾,例如
(?<!})<input>
您可以使用 RegExr 进行尝试:
http://gskinner.com/RegExr
如果您想匹配任何元素而不考虑类型或附加属性,您可以使用:
strRegex = "<input.*>";