-1
我有一個問題得到我的正則表達式模式來標識一個選項卡。這裏是我的代碼:正則表達式不計算標籤
$strings = array(
' abc',
'\tabc',
'^abc'
);
$count = 0;
foreach($strings as $string){
if (preg_match('/[\s\t\'^£$%&*()}{@#~?><>,|=_+¬-]/', $string)){
echo $string . "<br/>";
}
}
它只佔2項,abc
和^abc
,不\tabc
''\ tabc''不包含tab,'「\ tabc」'。 – str
請注意,\ s是一個空格字符,可以包含\ t,具體取決於語言。它在PHP中。 –
關於@ Phil的回答,如果你想匹配''\ t'',那麼你可以使用'\\\\ t' – 2013-07-30 00:26:41