Need help with preg_replace write up.

St_Aug_Beach_Bum
St_Aug_Beach_Bum used Ask the Experts™
on
I think I need preg_replace for this, but I don't know much about regular expression stuff.

I need any text in parentheses with the word 'pictured' in it, along with the parentheses, to eliminated.

For example:

$str = "this is a test (test pictured here like this) string";
//or
$str = "this is a test (test pictured) string";
//or
$str = "this is a test (pictured here) string";

to be converted to:

$str = "this is a test string";

Can you write this snippit for me?

Thanks,   Chris
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2008
Commented:
Try this:
$new_str = preg_replace('/\(.*pictured.*\)/','',$str);

Open in new window

Author

Commented:
Thank you!  Works excellently!

Author

Commented:
cxr, I have a follow up question here:

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_24606233.html

if you are around this morning :)

Chris

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial