Solved

Regex - Find between quotes and right of (

Posted on 2009-07-10
8
696 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Whatever be the reason, if you are working on web development side,  you will need day-today validation codes like email validation, date validation , IP address validation, phone validation on any of the edit page or say at the time of registration…
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…

776 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