manipulating strings (PHP)

Discussion in 'Mac Programming' started by BRUUUCE, Dec 3, 2007.

  1. BRUUUCE macrumors member

    Joined:
    Sep 7, 2006
    Location:
    Chicago
    #1
    I play a text based game where you attack each other. In this game, there is a newsfeed of all attacks. So if you get a kill shot, you can find it. I'm building a killshot logger/stat site where the user inputs their killshot and my site/database saves it and keeps track of all the data.

    here is copy/paste of a kill shot:

    Thu Jun 21 09:36:37 PDT 2007 SS Domesday damsel (#94) (MacDuff) PlayerName (#playerNumber) (ClanName) 9deaths / 0foodburned

    to help this make sense, it goes, date / typeofattack / (killer) user, userID, clan name / (dead) user, userID, clan name / civilians kills

    with the explode function, i can split everything into arrays because all the important info is separated by spaces. So everything was working until i realized the country names (bolded) could have spaces or multiple spaces. is there any way around this? Or am i going have to webfetch the whole newsfeed and grab by the tableIDs. I didn't want to go this route cause i want the user to input their kill shots, not my webpage constantly scanning for them.

    hope this makes sense

    thanks
     
  2. toddburch macrumors 6502a

    Joined:
    Dec 4, 2006
    Location:
    Katy, Texas
    #2
    You could use a regular expression. This is a good application for a "regex".

    Todd
     
  3. BRUUUCE thread starter macrumors member

    Joined:
    Sep 7, 2006
    Location:
    Chicago
    #3
    i googled regex - looks promising. hopefully i'll be back successful. thank you.
     

Share This Page