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. C#
  4. Regex issue

Regex issue

Scheduled Pinned Locked Moved C#
questionhelpregex
2 Posts 2 Posters 0 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.
  • I Offline
    I Offline
    Imtiaz Murtaza
    wrote on last edited by
    #1

    Hey guys, Can anyone help me in writing the simple regex. Here is the situation: I have a text file something like: // Contents // Contents MyDataBlock {    @$       The datablock text    @$ } // Contents // Contents I want to extract "The datablock text". There is single "MyDataBlock" in this text file. It means that i have to extract entire MyDataBlock {...} and then what is inside @$ into a regex group. I've created a regex. It is successfully extracting following in regex group <b>DataBlockContents</b>:    @$       The datablock text    @$ But i don't want @$ in the regex group DataBlockContents. How can i do so ? The regex i created is: MyDataBlock[\\w\\s]*{(?<DataBlockContents>[^}]*)}

    Imtiaz

    P 1 Reply Last reply
    0
    • I Imtiaz Murtaza

      Hey guys, Can anyone help me in writing the simple regex. Here is the situation: I have a text file something like: // Contents // Contents MyDataBlock {    @$       The datablock text    @$ } // Contents // Contents I want to extract "The datablock text". There is single "MyDataBlock" in this text file. It means that i have to extract entire MyDataBlock {...} and then what is inside @$ into a regex group. I've created a regex. It is successfully extracting following in regex group <b>DataBlockContents</b>:    @$       The datablock text    @$ But i don't want @$ in the regex group DataBlockContents. How can i do so ? The regex i created is: MyDataBlock[\\w\\s]*{(?<DataBlockContents>[^}]*)}

      Imtiaz

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

      The same way you don't get the { and } in the group? Do you have control over how the file is formatted? Why use @$ instead of something else?

      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