Regex issue
-
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
-
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
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?