PHP Regular Expression Exercises: Extract text (within parenthesis) from a string
PHP regular expression: Exercise-6 with Solution
Write a PHP script to extract text (within parenthesis) from a string.
Sample strings : 'The quick brown [fox].'
<?php $my_text = 'The quick brown [fox].'; preg_match('#\[(.*?)\]#', $my_text, $match); print $match."\n"; ?>
PHP Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?