Help with using Python Regex to find a certain block of code in a file and replace it? My question pertains to a source
Posted: Fri Jul 08, 2022 6:40 am
Help with using Python Regex to find a certain block of code ina file and replace it?
My question pertains to a source file having comment blocksformatted such as the following:
There are multiple blocks similar to this. And I need the firstoccurrence of this block. Here are a few stipulations:
What I have tried:
The problem with this is that when I go to print out what thismatches, it includes all of the lines that starts with “//# or //#”. The problem with that, is that i need only the firstoccurrence. additionally if i have anything in the file such as“//# [words…] “ it also includes this.
Any help would be greatly appreciated!
My question pertains to a source file having comment blocksformatted such as the following:
There are multiple blocks similar to this. And I need the firstoccurrence of this block. Here are a few stipulations:
What I have tried:
The problem with this is that when I go to print out what thismatches, it includes all of the lines that starts with “//# or //#”. The problem with that, is that i need only the firstoccurrence. additionally if i have anything in the file such as“//# [words…] “ it also includes this.
Any help would be greatly appreciated!