0
我必須替換URL中的字符,但只能形成某個點,並且還要處理重複字符。在某個字符/單詞之後替換字符,但跳過第一個匹配並處理重複
的網址是這樣的:
http://example.com/001-one-two.html#/param-what-ever
http://example.com/002-one-two-three.html#/param-what--ever-
http://example.com/003-one-two-four.html#/param2-what-ever-
http://example.com/004-one-two-five.html#/param33-what--ever---here-
,他們應該是這樣的:
http://example.com/001-one-two.html#/param-what_ever
http://example.com/002-one-two-three.html#/param-what_ever_
http://example.com/003-one-two-four.html#/param2-what_ever_
http://example.com/004-one-two-five.html#/param33-what_ever_here_
在口頭上與單個_
字符替換-
字符(任意數量的話),但跳過第一個-
之後
之後的字符串長度變化很明顯,我找不到一種方法來做到這一點。
我該怎麼做?
讓我們瞭解您到目前爲止試過。 –
strreplace找到'#/'後找到一個數組,但是沒有成功。 –