CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2006
    Posts
    306

    Regex For String Input

    This is sort of a general question, but it's with an application in C#.

    I'm using grammatica to generate parsers and stuff, so I need a regex for strings with double quotes.

  2. #2
    Join Date
    Jun 2008
    Posts
    2,477

    Re: Regex For String Input

    Code:
    "[^"\r\n]*"
    Here is a good site for testing this stuff (though I would suggest shelling out the $60 for RegEx Buddy if you do this stuff a lot).

    http://www.regexplanet.com/simple/index.jsp

  3. #3
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: Regex For String Input

    Quote Originally Posted by code? View Post
    This is sort of a general question, but it's with an application in C#.

    I'm using grammatica to generate parsers and stuff, so I need a regex for strings with double quotes.
    You can use double quotes in a regex but you need to write it in hex like \x20 for the space sign. So simple look for the hex of the doublequotes.
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  4. #4
    Join Date
    May 2006
    Posts
    306

    Re: Regex For String Input

    Quote Originally Posted by BigEd781 View Post
    Code:
    "[^"\r\n]*"
    Here is a good site for testing this stuff (though I would suggest shelling out the $60 for RegEx Buddy if you do this stuff a lot).

    http://www.regexplanet.com/simple/index.jsp
    Thanks, and also I use Rad Regex Designer, it's free and it's awesome.
    http://www.radsoftware.com.au/regexdesigner/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured