Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Regex - Find between quotes and right of (

Posted on 2009-07-10
8
Medium Priority
?
701 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 2000 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
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…
Suggested Courses

877 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