Reputation: 2277
I'm making a script to extract specified strings from a source code. The string may contain word and symbols. For example
a = "xyz" //1: loading.setText( "#{100}" );
I want to extract
"#{100}"
My regex is wrong, it takes out " //1: loading.setText( "
.
Upvotes: 1
Views: 120
Reputation: 31745
This will get you what you want:
loading\.setText\( ([^ ]+) )
It's the match group you are after.
if you don't want the quotes...
loading.setText( "([^"]+)" )
but it may not suffice - you have not explained what the variable patterns are in your sample string, so I guessed. If this doesn't work for you, you need to define your case better. What is the surrounding pattern that defines the data you want to extract? What is the defining pattern of the data itself?
Upvotes: 1