2
이 괄호 안에 문자열을 선택에 포함되지추출 텍스트는 괄호
$text = 'ignore everything except this (text)';
preg_match('#\((.*?)\)#', $text, $match);
echo $match[1] . ' /parentheses';
가 어떻게 괄호 안에없는 텍스트를 반향 수 ?
이 괄호 안에 문자열을 선택에 포함되지추출 텍스트는 괄호
$text = 'ignore everything except this (text)';
preg_match('#\((.*?)\)#', $text, $match);
echo $match[1] . ' /parentheses';
가 어떻게 괄호 안에없는 텍스트를 반향 수 ?
는 다음과 같은 시도 :
$text = 'ignore everything except this (text)';
preg_match('/(.*)\((.*?)\)/', $text, $match);
echo "in parenthesis: " . $match[2] . "\n";
echo "outside parenthesis: " . $match[1] . "\n";
없이는 괄호의 단일 세트를 가정 말.
시도 :
preg_match('^(*.?)\((*.?)\)(*.?)$', $text, $match);
echo $match[0] . $match[2];
괄호 한 세트 만 가정.
깔끔함! 감사!!! – woninana