Metasymbols and subpatterns : metasymbols « Regular Expression « Perl






Metasymbols and subpatterns

    

while(<DATA>){
    s/(\w+)\s(\w+)/$2, $1/; # Reverse first and last names
    print;
}
__DATA__
    First Last

   
    
    
    
  








Related examples in the same category

1.The word metasymbols
2.The metasymbol, \d
3.Using Special-Meaning Characters