Regular Expressions 101

Library entries

PHP Class Capture Groups from symbol string for Class, Namespace, Operation (Mutator or Accessor), Target and Method Names

Vote

1

Regular Expression
pcre2

/
(?<class>^(?<fully_qualified_class_name>(?<deliniator>(?<!\\)\\(?!\\)(?=(?P>fully_qualified_class_name))){0,1}[A-z_][\w]*)(?=::(?P>method)|$)|^(?<namespace>^(?P>fully_qualified_class_name)*)(?P>deliniator)(?P>fully_qualified_class_name)(?=::(?P>method)|$))(?<scope_resolution_operator>::(?=(?P>method)(?!$)))?(?<method>(?<=::)(?<operation>(?<mutator>[sS]et(?=[A-Z0-1_]|$))|(?<accessor>[gG]et(?=[A-Z0-1_]|$))|(?<condition>[iI]s(?=[A-Z0-1_]|$)|[hH]as(?=[A-Z0-1_]|$)))?_?(?<target>(?<=\w)\w*)|[A-z_]\w*)?$
/
gm

Description

Loading markdown...
Submitted by Jacob Canote - 8 months ago