請找到下面的Perl代碼相匹配,其期望正則表達式。
PERL代碼: -
#!C:\Perl64\bin
$regex = "<![CDATA[ Shanghai Taipei Tokyo !!!!?<,;'[*()&^%$#@! CDATA TorontoOxford ] is a registered [trade mark of Oxford University Pressin the UK New YorkRevised text ?? John Guy 2000 ]]>";
if ("$regex" =~ m/^(<!\[CDATA\[)/ && "$regex" =~ m/(\]\]>)$/)
{
print "Success scenario matched \n";
print "$regex is matched \n";
} else {
print "Failure scenario matched \n";
print "$regex is not matched \n";
}
輸出: -
Success scenario matched
<![CDATA[ Shanghai Taipei Tokyo !!!!?<,;'[*()&^%-1! CDATA TorontoOxford ] is a r
egistered [trade mark of Oxford University Pressin the UK New YorkRevised text ?
? John Guy 2000 ]]> is matched
希望這可以幫助你
感謝
雙雙創下。第一個很容易。我想你不會逃避的!根本就是括號。 – Thatoneguy7