Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
class\s(\w+)|def\s(\w+)
/
gm
Input 1
1
New
class MyClass_1(...): ... def method1_of_first_class(self): ... def method2_of_first_class(self): ... def method3_of_first_class(self): ... class MyClass_2(...): ... def method1_of_second_class(self): ... def method2_of_second_class(self): ... def method3_of_second_class(self): ...
Extraction