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
/
(?P<rulename><\S+>)\s*::=\s*(?P<production>(?:(?=\#)\#[^\r\n]*|(?!<\S+>\s*::=).+?)+)
/
gs
Input 1
New
# ***************************************************************************** # Smallest grammar # ***************************************************************************** # structure <predefined> ::= 'b0 = b1 = b2 = bool()' 'i0 = i1 = i2 = int()' 'res = int()' <code> # ***************************************************************************** <bool_var> ::= 'b0' | 'b1' | 'b2' <int_var> ::= 'i0' | 'i1' | 'i2' | 'in0' | 'in1' | 'in2' | 'in3' | 'res' # ***************************************************************************** <code> ::= <code><code> | <statement>'\n' <statement> ::= <assign> | <compound_stmt> <compound_stmt> ::= <if> | <while> # from bool <assign> ::= <bool_assign> # from int | <int_assign> <if> ::= <if-then> | <if-then><else> <if-then> ::= 'if '<bool><block> <else> ::= 'else'<block> <block> ::= ':{:\n'<code>':}' <while> ::= <loop-header>'while '<bool><loop-block>