...

View Full Version : Regular expression fetch attempt



florida
03-01-2010, 10: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.

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

which matches anything...

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

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum