Jump to content

preg_replace() remove things between but ignore rest


SharkBait

Recommended Posts

So how do I go about using preg_replace() to remove a portion of a string and ignoring the rest of it?

 

String: [http://this.is.my.site.com/stuff/funn] this is cool!

 

so that it only returns

 

this is cool!

 

I can't seem to get the regex pattern right

Anytime something shows up with [http://afdasdfsaf]

I guess anytime a URL shows up within square braces, i want to remove the square braces and the contents within them

 

I just want the the [http://afdasdfsaf] removed. Sorta like BBCode, but it isnt ;)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.