TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 03-22-2010, 07:29 AM   #1 (permalink)
The Wanderer
 
Join Date: Mar 2010
Posts: 9
Thanks: 2
dc2000 is on a distinguished road
Default Stuck with regexps in HTML again

Hi everyone:


I'm stuck with regular expressions again. Here's what I'm trying to accomplish. I need to add target=_blank to every hyperlink in the HTML. I use the following PHP code:

PHP Code:
$txt preg_replace("/<a\s+(.+)>/i""<a \\1 target=_blank>"$txt); 
But that seems to add it only to </a> tags. Why?
dc2000 is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Html 5 Randy XHTML, HTML, CSS 12 04-04-2013 09:26 AM
Exciting Stuff in HTML 5! Wildhoney XHTML, HTML, CSS 20 02-17-2013 03:16 PM
Trouble using regexps to explude HTML tags dc2000 General 6 03-18-2010 08:39 PM
Changing &eacute; into html entities without touching the html elements ? Peuplarchie General 1 11-10-2009 12:12 PM
Replace special chars not tags, php trigered by html Peuplarchie General 0 09-20-2009 02:32 PM


All times are GMT. The time now is 02:40 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design