After trying 10 times to rewrite this question to be accepted , i have a small text that have text between brackets, i want to extract that text so i wrote this expression :
/(\([^\)]+\))/i
but this only extracts text between first (
and last )
ignoring the rest of text
so is there any way to extract full text like :
i want(to) extract this text
from :
this is the text that (i want(to) extract this text) from
there might be more than one bracket enclosed sub-text .
Thanks
EDIT Found this :
preg_match_all("/\((([^()]*|(?R))*)\)/", $rejoin, $matches);
very usefull from the link provided in the accepted answer