PHP擴(kuò)展之文本處理(三)——POSIX正則表達(dá)式函數(shù)及使用示例
POSIX Regex函數(shù)
ereg_replace?— 正則表達(dá)式替換ereg?— 正則表達(dá)式匹配eregi_replace?— 不區(qū)分大小寫(xiě)的正則表達(dá)式替換eregi?— 不區(qū)分大小寫(xiě)的正則表達(dá)式匹配split?— 用正則表達(dá)式將字符串分割到數(shù)組中spliti?— 用正則表達(dá)式不區(qū)分大小寫(xiě)將字符串分割到數(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. .Net Core和RabbitMQ限制循環(huán)消費(fèi)的方法2. jsp網(wǎng)頁(yè)實(shí)現(xiàn)貪吃蛇小游戲3. asp(vbs)Rs.Open和Conn.Execute的詳解和區(qū)別及&H0001的說(shuō)明4. ASP.NET MVC遍歷驗(yàn)證ModelState的錯(cuò)誤信息5. 用css截取字符的幾種方法詳解(css排版隱藏溢出文本)6. ASP 信息提示函數(shù)并作返回或者轉(zhuǎn)向7. asp中response.write("中文")或者js中文亂碼問(wèn)題8. PHP設(shè)計(jì)模式中工廠模式深入詳解9. CSS hack用法案例詳解10. 將properties文件的配置設(shè)置為整個(gè)Web應(yīng)用的全局變量實(shí)現(xiàn)方法
