Dup Ver Goto 📝

RegexInLanguages

PT2/aw/lang/regex does not exist
To
21 lines, 61 words, 588 chars Page 'RegexInLanguages' does not exist.

Use in languages

Perl

See PerlCompatibleRegularExpressions for cheat sheet

/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

$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);