Help with using Python Regex to find a certain block of code in a file and replace it? My question pertains to a source

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Help with using Python Regex to find a certain block of code in a file and replace it? My question pertains to a source

Post by answerhappygod »

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!
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply