亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫
12下一頁
最近訪問板塊 發(fā)新帖
查看: 4160 | 回復(fù): 11
打印 上一主題 下一主題

為什么這樣的替換沒起作用 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2014-08-11 16:13 |只看該作者 |倒序?yàn)g覽
本帖最后由 feiying00917 于 2014-08-11 21:40 編輯

$booknum=1;
$ab='<text:p text:style-name="P332"><text:bookmark-start text:name="__DdeLink__4543_1635711675"/><text:span text:style-name="Teletype"><text:span text:style-name="T161">On schematic page 4, the ground pins GND (8) and THRM_PAD (29) of instances </text:span></text:span><text:bookmark-start text:name="__DdeLink__4522_16357116751"/><text:span text:style-name="Teletype"><text:span text:style-name="T161">U4 (MAXIM – MAX31790)</text:span></text:span><text:bookmark-end text:name="__DdeLink__4543_1635711675"/><text:bookmark-end text:name="__DdeLink__4522_16357116751"/><text:span text:style-name="Teletype"><text:span text:style-name="T161"> are not connected to ground currently. <text:s/>Recommend connecting these two pins to the ground. <text:s/>(Major)</text:span></text:span></text:p>';

$cd='<text:bookmark-start text:name="__DdeLink__4543_1635711675"/><text:span text:style-name="Teletype"><text:span text:style-name="T161">On schematic page 4, the ground pins GND (8) and THRM_PAD (29) of instances </text:span></text:span><text:bookmark-start text:name="__DdeLink__4522_16357116751"/><text:span text:style-name="Teletype"><text:span text:style-name="T161">U4 (MAXIM – MAX31790)</text:span></text:span><text:bookmark-end text:name="__DdeLink__4543_1635711675"/><text:bookmark-end text:name="__DdeLink__4522_16357116751"/><text:span text:style-name="Teletype"><text:span text:style-name="T161"> are not connected to ground currently. <text:s/>Recommend connecting these two pins to the ground. <text:s/>(Major)</text:span></text:span>';

$ab=~s/($cd)/<text:bookmark text:name=\"__RefNumPara__80266_$booknum\"\/>$1<text:bookmark-end text:name=\"__RefNumPara__80266_$booknum\"\/>/;

print  $ab;

$cd是$ab的子集,我現(xiàn)在是想在$cd字符串前后加上兩個(gè)標(biāo)記的字符串text:bookmark text:name="__RefNumPara__80266_$booknum"/>和<text:bookmark-end text:name="__RefNumPara__80266_$booknum"/>,這是一段xml的代碼,很亂的。程序運(yùn)行之后發(fā)現(xiàn)$ab的值沒有改變,求高手分析下。。

論壇徽章:
145
技術(shù)圖書徽章
日期:2013-10-01 15:32:13戌狗
日期:2013-10-25 13:31:35金牛座
日期:2013-11-04 16:22:07子鼠
日期:2013-11-18 18:48:57白羊座
日期:2013-11-29 10:09:11獅子座
日期:2013-12-12 09:57:42白羊座
日期:2013-12-24 16:24:46辰龍
日期:2014-01-08 15:26:12技術(shù)圖書徽章
日期:2014-01-17 13:24:40巳蛇
日期:2014-02-18 14:32:59未羊
日期:2014-02-20 14:12:13白羊座
日期:2014-02-26 12:06:59
2 [報(bào)告]
發(fā)表于 2014-08-11 16:46 |只看該作者
回復(fù) 1# feiying00917

1. quotemeta
or
2. \Q, \E

more information as below command:
$ perldoc -f quotemeta
or
$ perldoc perlre
$ perldoc perlretut
   

論壇徽章:
33
榮譽(yù)會(huì)員
日期:2011-11-23 16:44:17天秤座
日期:2014-08-26 16:18:20天秤座
日期:2014-08-29 10:12:18丑牛
日期:2014-08-29 16:06:45丑牛
日期:2014-09-03 10:28:58射手座
日期:2014-09-03 16:01:17寅虎
日期:2014-09-11 14:24:21天蝎座
日期:2014-09-17 08:33:55IT運(yùn)維版塊每日發(fā)帖之星
日期:2016-04-17 06:23:27操作系統(tǒng)版塊每日發(fā)帖之星
日期:2016-04-18 06:20:00IT運(yùn)維版塊每日發(fā)帖之星
日期:2016-04-24 06:20:0015-16賽季CBA聯(lián)賽之天津
日期:2016-05-06 12:46:59
3 [報(bào)告]
發(fā)表于 2014-08-11 17:21 |只看該作者
這么長的字符串, 真NB. 我表示看不清楚了.

論壇徽章:
0
4 [報(bào)告]
發(fā)表于 2014-08-11 21:36 |只看該作者
本帖最后由 feiying00917 于 2014-08-11 21:37 編輯

這個(gè)一段xml的文檔,我是想在<text:bookmark-start text:name="__DdeLink__4543_1635711675"/><text:span text:style-name="Teletype"><text:span text:style-name="T161">On schematic page 4, the ground pins GND (8) and THRM_PAD (29) of instances </text:span></text:span><text:bookmark-start text:name="__DdeLink__4522_16357116751"/><text:span text:style-name="Teletype"><text:span text:style-name="T161">U4 (MAXIM – MAX31790)</text:span></text:span><text:bookmark-end text:name="__DdeLink__4543_1635711675"/><text:bookmark-end text:name="__DdeLink__4522_16357116751"/><text:span text:style-name="Teletype"><text:span text:style-name="T161"> are not connected to ground currently. <text:s/>Recommend connecting these two pins to the ground. <text:s/>(Major)</text:span></text:span>這個(gè)前后加一對(duì)標(biāo)記的字符串, $cd是$ab的子集回復(fù) 3# q1208c


   

論壇徽章:
33
榮譽(yù)會(huì)員
日期:2011-11-23 16:44:17天秤座
日期:2014-08-26 16:18:20天秤座
日期:2014-08-29 10:12:18丑牛
日期:2014-08-29 16:06:45丑牛
日期:2014-09-03 10:28:58射手座
日期:2014-09-03 16:01:17寅虎
日期:2014-09-11 14:24:21天蝎座
日期:2014-09-17 08:33:55IT運(yùn)維版塊每日發(fā)帖之星
日期:2016-04-17 06:23:27操作系統(tǒng)版塊每日發(fā)帖之星
日期:2016-04-18 06:20:00IT運(yùn)維版塊每日發(fā)帖之星
日期:2016-04-24 06:20:0015-16賽季CBA聯(lián)賽之天津
日期:2016-05-06 12:46:59
5 [報(bào)告]
發(fā)表于 2014-08-12 07:51 |只看該作者
回復(fù) 4# feiying00917

我的意思是, 你有必要把這么長都是寫進(jìn)去么? 有要標(biāo)識(shí)的位置不就行了?
   

論壇徽章:
46
15-16賽季CBA聯(lián)賽之四川
日期:2018-03-27 11:59:132015年亞洲杯之沙特阿拉伯
日期:2015-04-11 17:31:45天蝎座
日期:2015-03-25 16:56:49雙魚座
日期:2015-03-25 16:56:30摩羯座
日期:2015-03-25 16:56:09巳蛇
日期:2015-03-25 16:55:30卯兔
日期:2015-03-25 16:54:29子鼠
日期:2015-03-25 16:53:59申猴
日期:2015-03-25 16:53:29寅虎
日期:2015-03-25 16:52:29羊年新春福章
日期:2015-03-25 16:51:212015亞冠之布里斯班獅吼
日期:2015-07-13 10:44:56
6 [報(bào)告]
發(fā)表于 2014-08-12 09:22 |只看該作者
這個(gè)用xml的模塊來處理比較好吧,清晰明了

論壇徽章:
0
7 [報(bào)告]
發(fā)表于 2014-08-12 09:27 |只看該作者
我很感謝你的留言,我把長字符串用abc代替,其實(shí)和下面的一樣,下面的替換就可以,但是我換成長字符串就不行了,我是奇怪這一點(diǎn),不是有意把問題描述的復(fù)雜,其實(shí)我們花時(shí)間去說我問題描述的復(fù)雜,還不如找到解決的辦法,請(qǐng)你看下,我覺得

$booknum=1;
$ab='<text:p text:style-name="P332">abc</text:p>';
$cd='abc';
$ab=~s/($cd)/bookmark_start$1bookmark_end/;
print OUTPUT $ab;

回復(fù) 5# q1208c


   

論壇徽章:
0
8 [報(bào)告]
發(fā)表于 2014-08-12 09:29 |只看該作者
本帖最后由 feiying00917 于 2014-08-12 09:30 編輯

之前我也用了xml的模塊,但是感覺模塊使用比較麻煩,所有我就直接自己在xml里解決了,你用什么建議的模塊回復(fù) 6# zhlong8


   

論壇徽章:
3
天蝎座
日期:2013-12-10 19:37:11酉雞
日期:2014-08-04 20:05:38雙魚座
日期:2014-08-09 21:53:54
9 [報(bào)告]
發(fā)表于 2014-08-12 12:46 |只看該作者
回復(fù) 1# feiying00917


    其實(shí)2樓已經(jīng)給你指出來了,不知道你有沒有嘗試過?

之所以沒有替換成功,應(yīng)該是$cd變量的值里面是有一些正則表達(dá)式的元字符在里面的,而你現(xiàn)在應(yīng)該是把$cd當(dāng)作一個(gè)普通的字符串,而不是一個(gè)正則表達(dá)式,所以應(yīng)該引起來或者使用\Q \E語法包圍起來。

剛剛看了幾天的perl,還不太熟,我的理解 2樓的意思應(yīng)該是:

  1. $ab=~s/(\Q$cd\E)/your pattern/;
復(fù)制代碼
@jason680不知道對(duì)不對(duì)?

論壇徽章:
145
技術(shù)圖書徽章
日期:2013-10-01 15:32:13戌狗
日期:2013-10-25 13:31:35金牛座
日期:2013-11-04 16:22:07子鼠
日期:2013-11-18 18:48:57白羊座
日期:2013-11-29 10:09:11獅子座
日期:2013-12-12 09:57:42白羊座
日期:2013-12-24 16:24:46辰龍
日期:2014-01-08 15:26:12技術(shù)圖書徽章
日期:2014-01-17 13:24:40巳蛇
日期:2014-02-18 14:32:59未羊
日期:2014-02-20 14:12:13白羊座
日期:2014-02-26 12:06:59
10 [報(bào)告]
發(fā)表于 2014-08-12 12:52 |只看該作者
回復(fù) 9# 歐陽西風(fēng)

You got it and I had verified already.

   
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP