Jump to content

get part of a string within the brackets


jasonc

Recommended Posts

i have taken a look at the preg_replace as i wish to echo the string part on the page.

 

i have taken a bit of code i have for another string that i have on the page and thought if i replaced the A-Z and replaced it with () it would also work, i dont understand how this should work.

 

substr(preg_replace("/([()])/",',\\1',$string),1)

 

the string could be many formats...

 

"something (this)"

"somthing (this) something else"

 

but it is just the part within the () that is needed.

 

 

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.