开发者

Match all Quoted String but filter on string before quote string

开发者 https://www.devze.com 2023-01-24 04:14 出处:网络
I\'m trying to make a regular expression testing for all quoted strings. It\'s okay. \\\"(?<InQuote>[^\\\"]*)\\\"开发者_运维问答

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

精彩评论

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