Lua 将字符串与特殊字符匹配 str=[]] print(string.match(str,“

Lua 将字符串与特殊字符匹配 str=[]] print(string.match(str,“,lua,Lua,Lua match)使用模式,而不仅仅是精确的字符串 更多的解释,请参阅 请参阅模式和魔法字符。使用string.match(str,() str = [[<?php code code ?>]] print(string.match(str, "<?")) //Actual Output: < , Expected Output: <? print(string.match(str, "<?php")) //Actual Output: php ,

Lua match)使用模式,而不仅仅是精确的字符串

更多的解释,请参阅

请参阅模式和魔法字符。

使用
string.match(str,()
str = [[<?php
code
code
?>]]

print(string.match(str, "<?"))    //Actual Output: < , Expected Output: <?
print(string.match(str, "<?php")) //Actual Output: php , Expected Output: <?php
print(string.find(str, "<?"))     //Actual Output: 1 1 , Expected Output: 1 2
print(string.match(str, "<?php")) //Actual Output: 3 5 , Expected Output: 1 5