1.preg_match() 这是一个正则表达式匹配的函数,其用法如下: 查找文本字符串"php": <?php //模式分隔符后的"i"标记这是一个大小写不敏感的搜索 if (preg_match("/php/i", "PHP is the web scripting language of choice.")) { echo "查找到匹配的字符串 php."; } else { echo &quo…
function trim1(s) return (s:gsub("^%s*(.-)%s*$", "%1")) end -- from PiL2 20.4 function trim2(s) return s:match "^%s*(.-)%s*$" end -- variant of trim1 (match) function trim3(s) return s:gsub("^%s+", ""):gsu…