LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   php & preg_match() (https://www.linuxquestions.org/questions/programming-9/php-and-preg_match-698367/)

Ateo 01-19-2009 10:58 AM

php & preg_match()
 
Hi,

I've run into a wall in which I'm not able to figure out the expression needed to make a match.

The string is:

Code:

# BEGIN RewriteEngine
RewriteEngine On
RewriteBase /
...Rewrite Rules...
# END RewriteEngine

I need to capture the text inside the 2 apache comments but for the life of me, I'm not able.

Here's what I currently have:
Code:

preg_match('/\# BEGIN RewriteEngine(.*?)\#END RewriteEngine/',$content,$match)
Where content is the string above.

I've tried a number of different variations but I think the # (pound sign) is what's giving me grief.

Any help would be appreciated.
Thanks

Ateo 01-19-2009 12:04 PM

PHP Code:

preg_match('/# BEGIN RewriteEngine(.*?)#END RewriteEngine/msU',$content,$match

is the code that works..

Thanks anyways..

=)


All times are GMT -5. The time now is 03:35 AM.