Regex - Find between quotes and right of (

what would the regex exp be for

1. Find text between AND INCLUDING quotes.  Ex:  The "big" Bear return "big" including quotes

2. Find the first "(" and everything after it  EX: The (big bear) returns (big bear) or The (big bear returns (big bear

Thanks
keschusterAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mrjoltcolaConnect With a Mentor Commented:
"[^"]*"


\(.*



You may have to escape the quotes depending on your API
0
 
mrjoltcolaCommented:
And if using capturing, then enclose both patterns in ()

("[^"]*")
 
 
(\(.*)

Open in new window

0
 
keschusterAuthor Commented:
how would you escape "[^"]*" in VBA
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
keschusterAuthor Commented:
what is capturing?  Example?
0
 
mrjoltcolaCommented:
Not sure in VBA, in C# or most others we would use backslash to put it inside a regex string

regexstr = "\"[^\"]*\""

capturing is so you can use the match api to retrieve only the portion of the regex that matches the pattern, which is often what you want. So for example, in a regex with multiple () groups, these would correlate to $1, $2, $3, or in .NET terms is MatchObj.Groups(1), MatchObj.Groups(2). etc.

http://www.regular-expressions.info/dotnet.html
0
 
keschusterAuthor Commented:
pattern = Chr(34) + "[^" + Chr(34) + "]*" did it.

Thanks!!
0
 
mrjoltcolaCommented:
Great. Read that link I provided, it has some .NET VBA samples.

Good luck.
0
 
amit_gCommented:
>>how would you escape "[^"]*" in VBA

oRegExp.Pattern =  """[^""]*"""
0
All Courses

From novice to tech pro — start learning today.