Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 704
  • Last Modified:

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
0
keschuster
Asked:
keschuster
  • 4
  • 3
1 Solution
 
mrjoltcolaCommented:
"[^"]*"


\(.*



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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now