Removing parentheses with data between them

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Removing parentheses with data between them

Post by tecktalkcm0391 »

How can I get a regular expression (i am soooo not good with them :oops:) so that I can remove anything in parentheses..

So here is a string (that I only want first half would now be)
So here is a string
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

That's pretty simple.

Code: Select all

\([^\)]*\)

Code: Select all

\(.*?\)
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

FYI, you'll be using preg_replace() for those patterns.
Post Reply