Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
r"
(?sm)#c\n(.*?)\n[^\S\r\n]*#-c
"
g
Input 1
New
# -*- coding: utf-8 -*- """ Title: blablabla Author: Mathieu Description: Report the some measurements """ import time import uuid from database.model import TestLimit, TestResult from util import log #d """ blablabla some description which might be multiline """ #-d # Constants #c CONSTANT_1 = 10 # Unit CONSTANT_2 = 2 # Unit #-c class Foo(Fp): def __init__(self, #some parameters): # some init def _run(self, #some parameters): #%% Section Title 1 #%%% Sub section Title 1 #c code I would like to catch can be multiple liens #-c with something.open(): #%%% Sub section title 2 #d """some description I want to catch""" #-d #c some more code I want to catch #-c
Substitution
# -*- coding: utf-8 -*- """ Title: blablabla Author: Mathieu Description: Report the some measurements """ import time import uuid from database.model import TestLimit, TestResult from util import log #d """ blablabla some description which might be multiline """ #-d # Constants #c CONSTANT_1 = 10 # Unit CONSTANT_2 = 2 # Unit #-c class Foo(Fp): def __init__(self, #some parameters): # some init def _run(self, #some parameters): #%% Section Title 1 #%%% Sub section Title 1 #c code I would like to catch can be multiple liens #-c with something.open(): #%%% Sub section title 2 #d """some description I want to catch""" #-d #c some more code I want to catch #-c