PHP擴(kuò)展之文本處理(三)——POSIX正則表達(dá)式函數(shù)及使用示例
POSIX Regex函數(shù)
ereg_replace?— 正則表達(dá)式替換ereg?— 正則表達(dá)式匹配eregi_replace?— 不區(qū)分大小寫的正則表達(dá)式替換eregi?— 不區(qū)分大小寫的正則表達(dá)式匹配split?— 用正則表達(dá)式將字符串分割到數(shù)組中spliti?— 用正則表達(dá)式不區(qū)分大小寫將字符串分割到數(shù)組中sql_regcase?— 產(chǎn)生用于不區(qū)分大小的匹配的正則表達(dá)式使用示例:
<?php//?Returns?true?if?'abc'?is?found?anywhere?in?$string.ereg('abc',?$string);//?Returns?true?if?'abc'?is?found?at?the?beginning?of?$string.ereg('^abc',?$string);//?Returns?true?if?'abc'?is?found?at?the?end?of?$string.ereg('abc$',?$string);//?Returns?true?if?client?browser?is?Netscape?2,?3?or?MSIE?3.eregi('(ozilla.[23]|MSIE.3)',?$_SERVER['HTTP_USER_AGENT']);//?Places?three?space?separated?words?into?$regs[1],?$regs[2]?and?$regs[3].ereg('([[:alnum:]]+)?([[:alnum:]]+)?([[:alnum:]]+)',?$string,?$regs);//?Put?a?<br?/>?tag?at?the?beginning?of?$string.$string?=?ereg_replace('^',?'<br?/>',?$string);//?Put?a?<br?/>?tag?at?the?end?of?$string.$string?=?ereg_replace('$',?'<br?/>',?$string);//?Get?rid?of?any?newline?characters?in?$string.$string?=?ereg_replace('n',?'',?$string);?>
相關(guān)文章:
1. Warning: require(): open_basedir restriction in effect,目錄配置open_basedir報(bào)錯問題分析2. ASP.NET Core 5.0中的Host.CreateDefaultBuilder執(zhí)行過程解析3. ASP調(diào)用WebService轉(zhuǎn)化成JSON數(shù)據(jù),附j(luò)son.min.asp4. SharePoint Server 2019新特性介紹5. ASP中常用的22個(gè)FSO文件操作函數(shù)整理6. React+umi+typeScript創(chuàng)建項(xiàng)目的過程7. php網(wǎng)絡(luò)安全中命令執(zhí)行漏洞的產(chǎn)生及本質(zhì)探究8. 無線標(biāo)記語言(WML)基礎(chǔ)之WMLScript 基礎(chǔ)第1/2頁9. 三個(gè)不常見的 HTML5 實(shí)用新特性簡介10. php測試程序運(yùn)行速度和頁面執(zhí)行速度的代碼
