Jump to content

Quick REGEX help needed..


Chud37

Recommended Posts

I need to match

 

(Click to Enlarge)

 

WITH the brackets.  Its at the bottom of thumbnails and I want to remove it.  I cannot work out what REGEX to use, Im new to it! So far i've got:

 

{\(Click to Enlarge\)}

 

But that is returning nothing.  Could someone please tell me what the best thing to use is and why!

 

:)

Link to comment
Share on other sites

You almost had it. The pattern delimiter's need to be identical, although I would strongly advise against using the squiggly brackets for them. I would suggest the tilde in this case. Try:

 

~\(Click To Enlarge\)~

Link to comment
Share on other sites

The pattern delimiter's need to be identical

 

Not quite true. You can also use  a pair of matching bracket-type characters such as <> and {}. I'm not sure why the regex you posted originally didn't work for you Chud37, it worked for me. Although there's really no need to use regex for simple string replacing. This would be much quicker:

 

$str = str_replace('(Click to Enlarge)', '', $str);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.