Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Regular Expressions
  4. [SOLVED] C Code Parsing

[SOLVED] C Code Parsing

Scheduled Pinned Locked Moved Regular Expressions
csharpvisual-studioregexjsonhelp
3 Posts 2 Posters 8 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Richard Andrew x64R Offline
    Richard Andrew x64R Offline
    Richard Andrew x64
    wrote on last edited by
    #1

    I'm trying to write a scanner using Flex. The problem is that one of my regex's works in the Visual Studio Find dialog, but not in Flex when tested on the same file! By "not working" I mean that it doesn't find any matches.

    \'((.)|(\\['"?\\abfnrtv])|(\\[0-7]{1,3})|(\\[Xx][0-9a-fA-F]+))\'

    This regex is supposed to recognize any character literals, like 'a', '\t', '\012', or '\x01AF'. Can anyone suggest why this regex is not finding any matches in Flex? SOLVED: It turns out that I had other rules that were consuming the character literals earlier in the process. :doh:

    The difficult we do right away... ...the impossible takes slightly longer.

    P 1 Reply Last reply
    0
    • Richard Andrew x64R Richard Andrew x64

      I'm trying to write a scanner using Flex. The problem is that one of my regex's works in the Visual Studio Find dialog, but not in Flex when tested on the same file! By "not working" I mean that it doesn't find any matches.

      \'((.)|(\\['"?\\abfnrtv])|(\\[0-7]{1,3})|(\\[Xx][0-9a-fA-F]+))\'

      This regex is supposed to recognize any character literals, like 'a', '\t', '\012', or '\x01AF'. Can anyone suggest why this regex is not finding any matches in Flex? SOLVED: It turns out that I had other rules that were consuming the character literals earlier in the process. :doh:

      The difficult we do right away... ...the impossible takes slightly longer.

      P Offline
      P Offline
      Peter_in_2780
      wrote on last edited by
      #2

      Taking a quick look at the (not terribly impressive) Flex docco, I'd suggest you try the Posix-compliance switch to Flex to see if that helps. Either way, you'll have eliminated some variables. fwiw, Expresso thinks you regex is OK. Cheers, Peter

      Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

      Richard Andrew x64R 1 Reply Last reply
      0
      • P Peter_in_2780

        Taking a quick look at the (not terribly impressive) Flex docco, I'd suggest you try the Posix-compliance switch to Flex to see if that helps. Either way, you'll have eliminated some variables. fwiw, Expresso thinks you regex is OK. Cheers, Peter

        Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

        Richard Andrew x64R Offline
        Richard Andrew x64R Offline
        Richard Andrew x64
        wrote on last edited by
        #3

        Peter_in_2780 wrote:

        Expresso thinks you regex is OK.

        Thanks for your help. I solved it. It turns out to be a case of the computer doing what I told it to do instead of what I wanted it to do.

        The difficult we do right away... ...the impossible takes slightly longer.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups