http://www.perlmonks.org?node_id=3595


in reply to Pig Latin

s/\b([aeiou])(\w*)/$1$2way/g; s/\b([^aeiou .]+)([aeiou]\w*)/$2$1ay/g;
This one handles spaces and periods, using greediness and word anchors to do the trick. It helps to handle rule b) first, when using two regexes.