LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-19-2009, 10:58 AM   #1
Ateo
Member
 
Registered: Sep 2004
Location: Long Beach, CA
Distribution: FreeBSD,Ubuntu,Gentoo,MacOS
Posts: 139

Rep: Reputation: 15
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
 
Old 01-19-2009, 12:04 PM   #2
Ateo
Member
 
Registered: Sep 2004
Location: Long Beach, CA
Distribution: FreeBSD,Ubuntu,Gentoo,MacOS
Posts: 139

Original Poster
Rep: Reputation: 15
PHP Code:
preg_match('/# BEGIN RewriteEngine(.*?)#END RewriteEngine/msU',$content,$match
is the code that works..

Thanks anyways..

=)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP & Apache - php files not processing aolong Linux - General 1 12-17-2006 03:09 AM
php preg_match help.. Ateo Programming 3 07-18-2006 03:57 PM
PHP: call to undefined function preg_match() (I think to do with PCRE) BuckRogers01 Linux - Software 1 10-17-2005 01:35 PM
php-devel & PHP extensions EHCanadian Mandriva 0 06-23-2005 06:06 PM
Passing variables to preg_match patterns? RecoilUK Programming 0 06-23-2003 10:57 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration