Solved

Regex - Find between quotes and right of (

Posted on 2009-07-10
8
697 Views
Last Modified: 2012-05-07
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
Comment
Question by:keschuster
  • 4
  • 3
8 Comments
 
LVL 40

Accepted Solution

by:
mrjoltcola earned 500 total points
ID: 24826967
"[^"]*"


\(.*



You may have to escape the quotes depending on your API
0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24826979
And if using capturing, then enclose both patterns in ()

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

Open in new window

0
 

Author Comment

by:keschuster
ID: 24827035
how would you escape "[^"]*" in VBA
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:keschuster
ID: 24827043
what is capturing?  Example?
0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24827092
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
 

Author Comment

by:keschuster
ID: 24827109
pattern = Chr(34) + "[^" + Chr(34) + "]*" did it.

Thanks!!
0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24827118
Great. Read that link I provided, it has some .NET VBA samples.

Good luck.
0
 
LVL 58

Expert Comment

by:amit_g
ID: 24827123
>>how would you escape "[^"]*" in VBA

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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question