![]() |
preg_replace limit results
Hi,
I want to extract the value between [SiteName] from $postText and save it as $s_sitename. Is preg_replace the best way to do this? Here is what i have so far: PHP Code:
Thanks! |
PHP Code:
|
Thanks Wildhoney,
Using your bit of code and 2 mins on php.net i found exactly what i needed :) |
Noticed a slight problem now, if there is a return in the middle of the 2 SiteNotes it doesnt display anything. Here is what i have so far:
PHP Code:
Thanks, Mike |
Add the
s modifier after the i at the end of the pattern: ~\[SiteNotes\](.+?)\[/SiteNotes\]~is This turns on the PCRE_DOTALL flag so that . includes newlines. |
That worked perfectly - thank you.
|
| All times are GMT. The time now is 03:03 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0