View Full Version : Regular expression fetch attempt

03-01-2010, 11:14 PM
I am trying to fetch anything before the AAAA in this example:
James B.AAAAOther I would need to get James B.

The firstname part is coming from a variable and will be different everytime but need to just fetch anything before the AAAA part:
MikeAAAACar I would need to get Mike
Nancy (Deb)AAAABus I Would need to get Nancy (Deb)

My attempt almost works but need help on my regular expression because it doesnt work if there is a non letter before AAAA such as Ed O.AAAAOther or Carrie (Kat)AAAAOther

[A-Za-z ]+?AAAA

Please advise.

03-02-2010, 07:06 AM
try (.*)

which matches anything...

03-02-2010, 07:29 AM
to be more specific..

$x =~ /^(.*)(AAAA);