开发者

Match all Quoted String but filter on string before quote string

I'm trying to make a regular expression testing for all quoted strings. It's okay.

\"(?<InQuote>[^\"]*)\"开发者_运维问答

But I also ned to filter on some test before the quote. E.g. "test".. So that only those lines with the string "test" before a quote is listed.

aTestButton.Text("some string in qoute"); //get this
aButton.Text("some string in qoute"); //don't get this


Add test.* in front of your regular expression, i.e.

test.*\"(?<InQuote>[^\"]*)\" 

If you want to match the example you provided in your question, be sure to specify the "case-insensitive" modifier on your regex search. How this is done depends on the programming language that you use.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜