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.
精彩评论