Current location: Hot Scripts Forums » Programming Languages » PHP » Regular Expression to match this html


Regular Expression to match this html

Reply
  #1 (permalink)  
Old 11-02-09, 08:27 AM
kevinkhandublin kevinkhandublin is offline
Newbie Coder
 
Join Date: Jul 2009
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Regular Expression to match this html

I want a regular expression that will match this html code

PHP Code:

<li class="tel"><strong>Tel:&nbsp;</strong><span><!-- sphoneid telnr="+353 (021)4501172" fileas="Abbey Business & Communications" -->(021)4501172<!-- sphoneid --></span></li
I set up this one but it doesnt seem to work?

PHP Code:

strContactMatches2 '~<li class="tel"><strong>Tel:&nbsp;</strong><span><!-- sphoneid telnr="(.*)" fileas="(.*)" -->(.*)<!-- sphoneid --></span></li>~isU'

What is wrong does anyone know
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-02-09, 10:31 AM
Keith's Avatar
Keith Keith is offline
Community Liaison
 
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
Have a look at escaping special characters, such as <, >, -, etc...
PHP: preg_quote - Manual
__________________
The toxic ZCE
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 11-02-09, 12:00 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Try this:

PHP Code:

<li class="tel"><strong>Tel\:&nbsp;<\/strong><span><\!-- sphoneid telnr="\+353 \(021\)4501172" fileas="Abbey Business & Communications" -->\(021\)4501172<\!-- sphoneid --><\/span><\/li
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regular Expression mohit Everything Java 9 05-08-08 05:55 AM
How retrieve all links in HTML page (regular expression)? Jam2005 PHP 1 04-07-06 07:55 AM
Help with regular expression... :) eddyvlad PHP 2 01-08-06 11:10 PM
regular expression for parsing url link musmanm80 Perl 1 07-28-05 12:58 AM
Regular Expression KHWright Visual Basic 0 06-02-05 07:40 PM


All times are GMT -5. The time now is 04:19 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.