Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
preg_replace (syntax between two word not match then replace or url syntax not match
12-07-2014, 07:31 AM,
Post: #1
preg_replace (syntax between two word not match then replace or url syntax not match
PHP Code:
$string '<a href="https://www.uptime.com/v/_JM?version=3" />PLAY</a></div>
<a href="https://newtime.uptime.com/v/_JM?version=3" />[email protected]</a></div>
<div class="class"><a href="https://www.firstdot.com/[email protected]/jdhdd.html" />LINKUP</a></div>
<a href="https://subdomain.uptime.com/v/[email protected]%ljdmmcc=3" />subd</a></div>
<a href="https://www.cng.com/v/_JM?dkkkk#3" />GETUp</a></div>
'

remove Link except *.uptime.com*
HOw Can Get Result From String (OUTPUT)


Code:
<a href="https://www.uptime.com/v/_JM?version=3" />PLAY</a></div>
<a href="https://newtime.uptime.com/v/_JM?version=3" />[email protected]</a></div>
<div class="class"></div>
<a href="https://subdomain.uptime.com/v/[email protected]%ljdmmcc=3" />subd</a></div>
</div>
[Image: 728x90.gif] :)  http://directapp.in/DLook/2018_v8Dy59 Click on This And See Magic  Tongue

Reply
12-07-2014, 05:14 PM, (This post was last modified: 12-07-2014, 05:16 PM by ionutvmi.)
Post: #2
RE: preg_replace (syntax between two word not match then replace or url syntax not match
you can achieve that by using a negative lookbehind.

here is a really simple example:
Code:
https?:\/\/([a-zA-Z0-9]+\.(?!uptime))[^"]+

Using this idea you should be able to select all the link tags and that don't have uptime in them and remove them from your string.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)