php get string between two strings regex, php extract string between brackets, get string between two strings php, php substring,php get nth character of string, get string between two tags php, preg_match between two characters,php last character of string
while working on a php file containing string “This is (Name). I live in (India). and so on with other brackets as well” , i was I trying to extract whatever text comes inside (). Desired output should be “Name”, “Turkey”. I have tried this.But Only getting first output which is “Name” but require “Turkey” and so on values whatever comes in brackets if the length of text increases.
If you are also facing this issue then you can try this below code
$string = 'This is (Name). I live in (India). and so on with other brackets as well'; preg_match_all('/\((.*?)\)/i', $string, $matches); print_r($matches);