On Thu, Dec 6, 2012 at 8:51 PM, JD KF <lists / ruby-forum.com> wrote:
> So, basically, I'm trying to get the below code to work properly for
> "piglatin".  I have gotten it to work with mulitple words, if the word
> starts with a vowel, if the word starts with a consonant, and if the
> word starts with two consonants.  This was a hell of a lot of trial and
> error getting to this point.
>
> However, I am stuck and need a little help getting unstuck.  One thing
> about "piglatin" is that I need to turn words like "quale" into
> "alequay".  Also I need to have words like "square" to turn into
> "aresquay".  AKA, if qu shows up somewhere, I need those letters (and
> any that proceed it) to shift to the back and ad an +ay to the end.

> word =3D "squa=ADre"
=3D> "square"
> first, secon=ADd =3D word.=ADmatch(/(.*=ADqu)(.*)/).=ADcaptures
=3D> ["squ", "are"]
> "#{second}=AD#{first}ay=AD"
=3D> "aresquay"

Jesus.