Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Posts
    362
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Regular expression fetch attempt

    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
    Code:
    [A-Za-z ]+?AAAA
    Please advise.

  • #2
    New Coder MetalGear's Avatar
    Join Date
    Feb 2008
    Location
    Jambudvipa
    Posts
    56
    Thanks
    6
    Thanked 1 Time in 1 Post
    try (.*)

    which matches anything...

  • #3
    New Coder MetalGear's Avatar
    Join Date
    Feb 2008
    Location
    Jambudvipa
    Posts
    56
    Thanks
    6
    Thanked 1 Time in 1 Post
    to be more specific..
    Code:
    $x =~ /^(.*)(AAAA);


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •