DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Frank Oquendo Guest

    RegEx help needed

    Is it possible for RegEx to take the following string:

    <QTY * WEIGHT> lbs.

    And return the following tokens?:

    QTY * WEIGHT
    lbs.

    IOW, can I split a string on "<>"?

    --
    There are 10 kinds of people. Those who understand binary and those who
    don't.

    http://code.acadx.com
    (Pull the pin to reply)



  2. #2
    Eric Gunnerson Guest

    Re: RegEx help needed

    Sure. I'd probably use:

    <(?<Value>.+?)>

    --
    Eric Gunnerson

    Visit the C# product team at http://www.csharp.net
    Eric's blog is at http://blogs.gotdotnet.com/ericgu/

    This posting is provided "AS IS" with no warranties, and confers no rights.
    "Frank Oquendo" <frankopin@acadx.com> wrote in message
    news:3f96d989$1@devx7.web.devx.com...
    > Is it possible for RegEx to take the following string:
    >
    > <QTY * WEIGHT> lbs.
    >
    > And return the following tokens?:
    >
    > QTY * WEIGHT
    > lbs.
    >
    > IOW, can I split a string on "<>"?
    >
    > --
    > There are 10 kinds of people. Those who understand binary and those who
    > don't.
    >
    > http://code.acadx.com
    > (Pull the pin to reply)
    >
    >




  3. #3
    Roberto Martinez-Brunet Guest

    Re: RegEx help needed

    Frank,

    What about

    <(.*)>(.*)

    I'm using RegexDesigner.NET from http://www.sellsbrothers.com/tools/

    I found
    http://www.amazon.com/exec/obidos/tg...glance&s=books
    by Dan Appleman very good

    Rgds,

    R-o

    "Frank Oquendo" <frankopin@acadx.com> wrote in message
    news:3f96d989$1@devx7.web.devx.com...
    > Is it possible for RegEx to take the following string:
    >
    > <QTY * WEIGHT> lbs.
    >
    > And return the following tokens?:
    >
    > QTY * WEIGHT
    > lbs.
    >
    > IOW, can I split a string on "<>"?



  4. #4
    Frank Oquendo Guest

    Re: RegEx help needed

    Eric Gunnerson wrote:
    > Sure. I'd probably use:
    >
    > <(?<Value>.+?)>


    That's the one. Thanks a bunch, Eric. After doing a little research on
    RegEx, I discovered how to use a MatchEvaluator function to greatly
    simplify the task of evaluating algebraic expressions at runtime.

    No more recursive code. Yay!

    --
    There are 10 kinds of people. Those who understand binary and those who
    don't.

    http://code.acadx.com
    (Pull the pin to reply)



  5. #5
    Frank Oquendo Guest

    Re: RegEx help needed

    Roberto Martinez-Brunet wrote:

    > I'm using RegexDesigner.NET from http://www.sellsbrothers.com/tools/


    That's an outstanding little tool. I especially like the code generator.
    Thanks for the tip, Roberto.

    --
    There are 10 kinds of people. Those who understand binary and those who
    don't.

    http://code.acadx.com
    (Pull the pin to reply)



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links