如何使用正则表达式表示以下字符串?

时间:2011-11-10 15:03:56

标签: regex msbuildcommunitytasks

我想用正则表达式表示以下字符串。

这句话:

pro displ = "monitor" id="1"

我试过了:

pro displ=(("[^"]*")monitor(("[^"]*") id =(("[^"]*")1(("[^"]*")

但它不起作用。我是正常表达的新手,请帮我解决这个问题

2 个答案:

答案 0 :(得分:0)

<prop.*disp=\"(.*)\".*id=\"(.*)\".*>

你可以使用这个,然后匹配括号来改变你想要的东西。

而是使用'sed'实用程序:

<prop.*disp=\"\(.*\)\".*id=\"\(.*\)\".*>

答案 1 :(得分:-1)

我认为这应该与字符串匹配:

pro\sdispl=["]monitor["]\sid=["]1["]
相关问题