Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

/
(\w+)\s*\((\w)\)\s*->\s*(\w+)
/
gm

Description

parses and groups elements inside the definition of a finite automaton, defined by the following backus naur form

state ::= [a-zA-Z]+
set_of_final_states ::= "final states" = {state}

simbol ::= [a-zA-Z]

transition_arrow ::= "(" simbol ")" "->" 
transition ::= state transition_arrow state
Submitted by anonymous - 9 hours ago