Perl Regex Examples
Syntax
Misc
Bad and Good Extraction using Regular Expressions
# Always use named capute groups and %+, for example: if($str =~ /(?<field1>\w+)\s+(?<field2>\w+)(\s+(?<field3>\w+))?/) { %result = %+; }
Bad and Good Extraction using Regular Expressions
# Always use named capute groups and %+, for example:
if($str =~ /(?<field1>\w+)\s+(?<field2>\w+)(\s+(?<field3>\w+))?/) {
%result = %+;
}