"php: best way to extract text within parenthesis?" Answer’s

0

i'd just do a regex and get it over with. unless you are doing enough iterations that it becomes a huge performance issue, it's just easier to code (and understand when you look back on it)

$text = 'ignore everything except this (text)';
preg_match('#((.*?))#', $text, $match);
print $match[1];
Wednesday, March 31, 2021
 
ramdemon
answered 11 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 
Share