Re: Pls Help: Splitting An String



On 08/27/2006 04:39 AM, Unknown wrote:
Hi All,

First of all, I am fairly new to PHP and am in all honesty a "modifier" rather then a "coder", but I am trying to learn.

If this is the wrong group to post, I would apprichate some forums / newsgroups or websites that I could be directed to.

Here is my problem...

I host a killboard for a game (Eve Online) and the killboard has the following code...

if( preg_match("(^Destroyed\:.*?)", trim($arrLines[$i])) && $strMode == 0) {
$strVICTIMTYPE = trim(substr(trim($arrLines[$i]), 11, strlen($arrLines
[$i])));

....what this does is put whatever is past "Destoyed:" into the "$strVICTIMTYPE" string.

Now things have changed with the way some information is presented and we can have the following information...

Destroyed: <Various> Control Tower / <Various> (Laid The Final Blow)

What I need to do is manage this line output so...

"<Various> Control Tower" goes into one string.
" / " is ignored.
"<Various>" goes into another string.
" (Laid The Final Blow)" is ignored.


preg_match('/(.*?) Control Tower \/ (.*?) \(Laid The/', $string, $matches)


....I would truely apprichate any assistance here. As I am going around
^^^^^^^^^^

appreciate

in circles.

Many thanks.

.



Relevant Pages

  • Pls Help - PHP String Question
    ... rather then a "coder", but I am trying to learn. ... I host a killboard for a game and the killboard has the ... "$strVICTIMTYPE" string. ... ....I would truely apprichate any assistance here. ...
    (alt.php)
  • Pls Help: Splitting An String
    ... rather then a "coder", but I am trying to learn. ... I host a killboard for a game and the killboard has the ... "$strVICTIMTYPE" string. ... ....I would truely apprichate any assistance here. ...
    (php.general)