# Use in languages ## Perl See PerlCompatibleRegularExpressions for cheat sheet ```perl /hello/; # apply match /hello/ to $_ $a = /hello/; # apply match /hello/ to $a s/hello/world/; # replace hello with world s@hello@a/b/c@; # alternative delimiter, useful when strings contain / ``` ## Php ```php $pat = "/etc/"; # note delimiters in string preg_match($pat,$input,&$matches,$flags=0,$offset=0); preg_replace($pat,$repl,$input); preg_replace_callback($pat,"function_name",$input); preg_replace_callback($pat,[$obj,"method_name"],$input); preg_split($p,$input); ```