SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast slide's Avatar
    Join Date
    Sep 2004
    Location
    Baton Rouge, La
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    regex matching across mutliple lines

    I am trying to match some text inside html comments using a regular expression.

    Im trying to get "thumbnails" out then also

    HTML Code:
    	<div class="thumbnail">
    		<a href="gallery.php?gallery=%[GALLERY]&amp;image=%[IMAGE]">
    			<img src="%[IMAGEURL]" class="thumbnail" alt="%[CAPTION]" style="top: " />
    		</a>
    		<a href="gallery.php?gallery=%[GALLERY]&amp;image=%[IMAGE]" class="caption">%[CAPTION]</a>
    	</div>
    Example of what im mathing
    HTML Code:
    <!-- section:thumbnails
    	<div class="thumbnail">
    		<a href="gallery.php?gallery=%[GALLERY]&amp;image=%[IMAGE]">
    			<img src="%[IMAGEURL]" class="thumbnail" alt="%[CAPTION]" style="top: " />
    		</a>
    		<a href="gallery.php?gallery=%[GALLERY]&amp;image=%[IMAGE]" class="caption">%[CAPTION]</a>
    	</div>
    -->
    Once you eliminate the impossible, whatever remains,
    no matter how improbable, must be the truth.

  2. #2
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    preg_match('~<!--\s+section:thumbnails(.*?)-->~ms'$content$matches); 
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •