Re: Find Strings (Tokens) in File and push them into an array - How? [message #169541 is a reply to message #169538] |
Fri, 17 September 2010 12:31 |
matt[1]
Messages: 40 Registered: September 2010
Karma:
|
Member |
|
|
On Sep 17, 8:17 am, DigitalDude <e.blumsten...@googlemail.com> wrote:
> Just for the record: the parsing is not the problem, just how to get
> the token from the file into my array. I need to copy each token that
> matches a pattern (e.g. "$__txt" or so) and then save it as a string
> into an array (which I would probably do with array_psuh or so).
Sounds like you need regex:
preg_match_all("/(\$__txt[^;]*);/", $fileTextString, $matches);
print_r($matches);
Not a complicated job to take structure of $matches and manipulate it
to your needs.
ref: http://us2.php.net/manual/en/book.pcre.php
|
|
|