- or download this
'Chi_2' =~ /\bChi_2\b/ # Match
'!Chi_2!' =~ /\bChi_2\b/ # Match
- or download this
($_ = '\\Chi+3' ) =~ s/\\Ch\b/$ch/g; # Won't replace
($_ = '\\Chi+3' ) =~ s/\\Chi\b/$chi/g; # Will replace
($_ = '\\Chi_2+3') =~ s/\\Chi\b/$chi/g; # Won't replace
- or download this
($_ = '\\Chi+3' ) =~ s/\\Ch???/$ch/g; # Won't replace
($_ = '\\Chi+3' ) =~ s/\\Chi???/$chi/g; # Will replace
($_ = '\\Chi_2+3') =~ s/\\Chi???/$chi/g; # Will replace
- or download this
/\\([a-zA-Z]+)/ exists($vars{$1}) ? $vars{$1} : "\\$1" /eg