點我使用這個例子:與<br />使用正則表達式替換的perl
New Zealand cyclist Jack Bauer didn't know it during the Olympic road race, but there was a scantily-clad Kiwi 'snow angel' above him. http://www.stuff.co.nz/sport/olympics/7374497/Near-naked-snow-angel-over-cycle-road-race
我想句號後添加<br />
標籤,但不是在HTTP鏈接。就在句子結尾。
目前我使用:
$full_story = $read_story->[0]{story_text};
$full_story =~ s/(\D)\.(\D)/<br \/><br \/>/i;
使用此代碼它添加<br />
但him
的m
被刪除。
最終結果:
New Zealand cyclist Jack Bauer didn't know it during the Olympic road race, but there was a scantily-clad Kiwi 'snow angel' above him.
http://www.stuff.co.nz/sport/olympics/7374497/Near-naked-snow-angel-over-cycle-road-race
我在做什麼錯?
嗨,如何重複搜索。它只替換了第一句,對不起,我在正則表達式中很糟糕。 – jbcedge 2012-08-16 21:34:37
添加「g」修飾符,例如''.../ig''。 – 2012-08-16 21:35:35
謝謝,但它有一種方法可以從http標籤中獲取它,因爲它會破壞http鏈接:http:// www。 東西。 co。 nz/sport/olympics/7374497 /近乎裸露的雪天使過週期公路賽 – jbcedge 2012-08-16 21:38:24