| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> perl >> shi yong Perl chang gui biao da shi jin xing pi pei

shi yong Perl chang gui biao da shi jin xing pi pei

2008-12-22 08:08:04 编辑來源:互联网 评论
 
 
 
本文为【使用Perl常规表达式进行匹配】的拼音翻译版
  chang qi yi lai ,Perl yi qi dui chang gui biao da shi de gu you zhi chi , yi zhi shi fei chang liu xing de wen ben chu li gong ju 。 zai zhe pian ru men xing wen zhang zhong , wo men jiang dai ling ni jian dan le jie ru he zai ni zi ji de cheng xu zhong shi yong chang gui biao da shi , shi xian geng jia qiang da de wen ben sou suo he ti dai gong neng 。
  wo men shou xian le jie zui jian dan de chang gui biao da shi : pi pei 。 ru guo zai zi fu chuan zhong zhao dao xiang pi pei de mo shi , pi pei cao zuo jiu fan hui zhen zhi 。 yin ci xia mian de biao da shi :
  $string =~ m/text/
  zhi you zai bian liang “$string” zhong de zi fu chuan bao han zi zi fu chuan “text” shi cai fan hui zhen zhi 。 zhe shi zui ji ben de chang gui biao da shi , ta dui mei ge zi fu jin xing zhu zi pi pei 。 dang ran , zhe zhi shi dui chang gui biao da shi zuo yong de yi ge chang shi 。 yi xu yao cha zhao yi “ext” jie yi de si ge zi mu de dan ci wei li 。 wei da dao zhe ge mu de , wo men shi yong yi ge te shu de zi fu “.”, chang gui biao da shi zhong de ju hao gao su Perl pi pei qi zhong de ren he dan du de zi fu 。 yin ci xia mian zhe ge biao da shi :
  $string =~ m/.ext/
  jiang yu dan ci “text” he “next” pi pei 。
  bu guo , zhe ge biao da shi bing fei wan mei , yin wei ta yu bao han “ext” de geng chang dan ci de yi bu fen xiang pi pei , ru “dextrous” he “flextime”。 wo men ke yi shi yong mao zi fu lai xian zhi pi pei de wei zhi 。“^” zi fu pi pei zi fu chuan de kai tou , yin ci :
  $string =~ m/^.ext/
  yu “dextrous” pi pei , dan bu yu “context” pi pei 。
  tong yang ,“$” zi fu pi pei zi fu chuan de jie yi :
  $string =~ m/.ext$/
  yu “context” pi pei , dan bu yu “dextrous” pi pei 。
  ru guo ni zhi xi wang pi pei yi “ext” jie yi de si ge zi mu de zi fu chuan , na me ni ke yi zu he shi yong shang mian de liang ge biao da shi , xiang zhe yang :
  $string =~ m/^.ext$/
  xian zai , ru guo ni xu yao pi pei yi zu gei ding de zi fu , er bu shi ju hao wei zhi de ren he zi fu , na gai zen me ban ne ? chang gui biao da shi tong guo shi yong fang kuo hao ti gong yi ge fang fa 。 yi xia mian de biao da shi wei li :
  $string =~ m/^[tT]ext$/
  zhe ge biao da shi zhi yu dan ci “text” he “Text” pi pei 。 yi dui fang kuo hao jiang zhuan huan qi zhong de ren he dan ge zi fu 。 zhe ge gong neng xiang dang qiang da , li ru :
  $string =~ m/[aeiouAEIOU]/
  ru guo $string bian liang zhong han you yuan yin , ze shang mian de li zi fan hui zhen zhi 。
  ru guo kuo hao zhong de di yi ge zi fu shi “^”, zhe shi ta jiu bu shi yi ge mao zi fu , er shi zhi xing “ fei ” cao zuo , pi pei bu zai kuo hao nei de ren yi zi fu , yin ci ru guo $string bian liang zhong zhi bao han fu yin huo biao dian fu hao , ke yi dui shang mian de li zi jin xing tiao zheng , shi ta fan hui zhen zhi :
  $string =~ m/[^aeiouAEIOU]/
  fang kuo hao fu hao huan ke yi zhi ding zi fu de fan wei , rang ni bu bi lie ju yi zheng chuan lian xu de shu zi huo zi mu , li ru , xia mian de li zi pi pei ren he xiao xie zi mu :
  $string =~ m/[a-z]/
  dao xian zai wei zhi , wo men mei ci dou shi chu li zi fu chuan zhong de yi ge zi fu , dan xu duo qing kuang xia wo men xu yao chu li geng jia fu duo de wen ti 。 wo men shi yong “|” huo fen duan cao zuo da dao zhe ge mu de 。 jia she wo men xi wang jian cha $string bian liang zhong shi fou han you “next” huo “previous”, wo men ke yi shi yong xia mian de biao da shi :
  $string =~ m/next|previous/
  ru guo wo men xi wang zai zhe ge biao da shi zhong shi yong mao zi fu , na me wo men xu yao jiang xuan xiang zu he qi lai , jiu xiang zai suan shu zhong shi yong yuan kuo hao na yang 。 yin ci , ru guo wo men xi wang zhi pi pei zi fu chuan kai tou bu fen de “next” huo “previous”, ke yi zhe yang xie biao da shi :
  $string =~ m/^(next|previous)/【原文】【汉音对照
 
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
chang qi yi lai ,Perl yi qi dui chang gui biao da shi de gu you zhi chi , yi zhi shi fei chang liu xing de wen ben chu li gong ju 。 zai zhe pian ru men xing wen zhang zhong , wo men jiang dai ling ni jian dan le jie ru he zai ni zi ji de cheng xu zhong shi yong chang gui biao da shi , shi xian geng jia qiang da de wen ben sou suo he ti dai gong neng 。 wo men shou xian le jie zui jian dan de chang gui biao da shi : pi pei 。 ru guo zai zi fu chuan zhong zhao dao xiang pi pei de mo shi , pi pei cao zuo jiu fan hui zhen zhi 。 yin ci xia mian de biao da shi : $string =~ m/text/ zhi you zai bian liang “$string” zhong de zi fu chuan bao han zi zi fu chuan “text” shi cai fan hui zhen zhi 。 zhe shi zui ji ben de chang gui biao da shi , ta dui mei ge zi fu jin xing zhu zi pi pei 。 dang ran , zhe zhi shi dui chang gui biao da shi zuo yong de yi ge chang shi 。 yi xu yao cha zhao yi “ext” jie yi de si ge zi mu de dan ci wei li 。 wei da dao zhe ge mu de , wo men shi yong yi ge te shu de zi fu “.”, chang gui biao da shi zhong de ju hao gao su Perl pi pei qi zhong de ren he dan du de zi fu 。 yin ci xia mian zhe ge biao da shi : $string =~ m/.ext/ jiang yu dan ci “text” he “next” pi pei 。 bu guo , zhe ge biao da shi bing fei wan mei , yin wei ta yu bao han “ext” de geng chang dan ci de yi bu fen xiang pi pei , ru “dextrous” he “flextime”。 wo men ke yi shi yong mao zi fu lai xian zhi pi pei de wei zhi 。“^” zi fu pi pei zi fu chuan de kai tou , yin ci : $string =~ m/^.ext/ yu “dextrous” pi pei , dan bu yu “context” pi pei 。 tong yang ,“$” zi fu pi pei zi fu chuan de jie yi : $string =~ m/.ext$/ yu “context” pi pei , dan bu yu “dextrous” pi pei 。 ru guo ni zhi xi wang pi pei yi “ext” jie yi de si ge zi mu de zi fu chuan , na me ni ke yi zu he shi yong shang mian de liang ge biao da shi , xiang zhe yang : $string =~ m/^.ext$/ xian zai , ru guo ni xu yao pi pei yi zu gei ding de zi fu , er bu shi ju hao wei zhi de ren he zi fu , na gai zen me ban ne ? chang gui biao da shi tong guo shi yong fang kuo hao ti gong yi ge fang fa 。 yi xia mian de biao da shi wei li : $string =~ m/^[tT]ext$/ zhe ge biao da shi zhi yu dan ci “text” he “Text” pi pei 。 yi dui fang kuo hao jiang zhuan huan qi zhong de ren he dan ge zi fu 。 zhe ge gong neng xiang dang qiang da , li ru : $string =~ m/[aeiouAEIOU]/ ru guo $string bian liang zhong han you yuan yin , ze shang mian de li zi fan hui zhen zhi 。 ru guo kuo hao zhong de di yi ge zi fu shi “^”, zhe shi ta jiu bu shi yi ge mao zi fu , er shi zhi xing “ fei ” cao zuo , pi pei bu zai kuo hao nei de ren yi zi fu , yin ci ru guo $string bian liang zhong zhi bao han fu yin huo biao dian fu hao , ke yi dui shang mian de li zi jin xing tiao zheng , shi ta fan hui zhen zhi : $string =~ m/[^aeiouAEIOU]/ fang kuo hao fu hao huan ke yi zhi ding zi fu de fan wei , rang ni bu bi lie ju yi zheng chuan lian xu de shu zi huo zi mu , li ru , xia mian de li zi pi pei ren he xiao xie zi mu : $string =~ m/[a-z]/ dao xian zai wei zhi , wo men mei ci dou shi chu li zi fu chuan zhong de yi ge zi fu , dan xu duo qing kuang xia wo men xu yao chu li geng jia fu duo de wen ti 。 wo men shi yong “|” huo fen duan cao zuo da dao zhe ge mu de 。 jia she wo men xi wang jian cha $string bian liang zhong shi fou han you “next” huo “previous”, wo men ke yi shi yong xia mian de biao da shi : $string =~ m/next|previous/ ru guo wo men xi wang zai zhe ge biao da shi zhong shi yong mao zi fu , na me wo men xu yao jiang xuan xiang zu he qi lai , jiu xiang zai suan shu zhong shi yong yuan kuo hao na yang 。 yin ci , ru guo wo men xi wang zhi pi pei zi fu chuan kai tou bu fen de “next” huo “previous”, ke yi zhe yang xie biao da shi : $string =~ m/^(next|previous)/
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
可爱小魔女
夏日小桃红
琦吖囡半熟乖巧清新写真
天使的微笑
痞子的甘南日记
疑是银河落九天
雪域坝上四——纯美色
冬日恋歌——西城杨柳弄轻柔
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
 
©2005- 王朝网络 版权所有