나는 통화 기호로 숫자 만 포착하거나 pref_match_all 패턴을 사용하여 기호가없는 경우 숫자 만 사용합니다. 그러나 심볼을 포함하지 않는 $ 심볼 이외에는 아무것도 실패하지 않습니다. 여기 Preg_match_all 실패
내가 노력하고있어입니다 :include 'simple_html_dom.php';
$html = file_get_html($url);
// Find price if added our code
$ret = $html->find('.price');
$pattern = '/\p{Sc}\s*\d{1,3}(?:,\d{3})*(?:\.\d+)?/u';
simple_html_dom에 의해 그들이 작동 또는 실패 여부를 리턴 될 수 무엇의 예입니다 - 그것은 다음과 같은
$ret[0] = '<span class="price">100</span>'; // this returns null
$ret[0] = '<span class="price">£100</span>'; // this returns null
$ret[0] = '<span class="price">€100</span>'; // this returns null
$ret[0] = '<span class="price">$100</span>'; // this works correctly and returns $100
preg_match_all($pattern, $ret[0], $matches);
echo $matches[0][0];
의 하나가 될 수 어떤 아이디어?
사용 파서 ... 왜 나중에 HTML을 구문 분석하기 위해 정규 표현식을 사용합니까? –