Re: Re: [PHP] Search for string followed by whitespace

2011-09-23 Thread Daniel Brown
On Fri, Sep 23, 2011 at 13:21, Tim Streater  wrote:
>
> Dan,
>
> Thanks for the suggestion but I need to know where the string occurs as I 
> want to then do some excision/incision.

Consider preg_replace() with that same pattern.  Or, at the most
involved, preg_replace_callback().

-- 

Network Infrastructure Manager
http://www.php.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Search for string followed by whitespace

2011-09-19 Thread Daniel Brown
On Sun, Sep 18, 2011 at 15:12, Tim Streater  wrote:
> At the moment, I'm doing this:
>
>   $start = stripos ($body, "
> You'll note the space after the ' for ' $loc'th character, and returning the location of the string in $start.
>
> I had a look at the PCRE and POSIX regexp functions to no avail. Is there a 
> slick way of doing this with one function call or should I just search for 
> '
> Thanks,

Try something along this line:



Replace $text with the text through which you want to look, and
your results will be an array in $matches.  The \b switch in the
regexp will match any word/letter border, which includes whitespaces,
tabs, newlines, periods, et cetera.  Essentially, anything that you'll
want to match inside HTML tags, be they valid or otherwise.  The U
modifier makes the search "Ungreedy," while the i modifier makes it
case-iNsEnSiTiVe.

-- 

Network Infrastructure Manager
http://www.php.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Search for string followed by whitespace

2011-09-18 Thread Tim Streater
At the moment, I'm doing this:

   $start = stripos ($body, "-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php