Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 8th, 2004, 04:32 PM
Registered User
Join Date: Oct 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Regex Help


I need some help with a regular expression. I'm trying to parse, out of text, tags in the following forms:

<%Bar("aasd", "213")%>

I want to get the name of the function/tag in a named group, and pull out the parameters (the text inside the "" for each).

Here is what I have so far for the pattern I pass to the Regex object constructor:


This gets the names correctly ('Foo' and 'Bar'), but the ARGS group on ly contains the following:

    aasd", "213

I understand why I get this, but am at a loss as to how to get what I want. Any help would be appreciated; I'm starting to get a little frustrated. Thanks.

Reply With Quote
  #2 (permalink)  
Old October 8th, 2004, 05:33 PM
Friend of Wrox
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts


Why is the ? there? The ( is to group the first set of the regexp. Second, in the params part, I see no check for a , or white space.

Reply With Quote
  #3 (permalink)  
Old October 8th, 2004, 05:46 PM
Registered User
Join Date: Oct 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks for the respose.

The '?' is needed to signify a named group; it's necessary, and that part of the expression works fine.

I've since come up with this expression, which works better, but still isn't perfect:


With this, I get the separate parameters, but also the comma delimiters. So if the input was <%Foo("bar", "bar")%>, the captures in the ARGS group would be (without the single quotes):

', '
'' <- empty string

Again, I realize why this is happening, but no matter what change to the expression I try, I only succeed in breaking it completely.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regex pendemv JSP Basics 4 December 8th, 2008 08:29 AM
regex mrame XSLT 12 July 25th, 2008 09:37 AM
Regex htran XSLT 2 May 18th, 2005 09:21 AM
More regex help Snib Pro PHP 4 December 16th, 2004 09:56 PM
Need RegEx help Snib Pro PHP 6 November 16th, 2004 06:59 AM

All times are GMT -4. The time now is 10:02 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.