我有一個字符串在JavaScript這樣的:刪除子的JavaScript
frmSearch=FeeType=RecordingSpend:LoginID=:PersonCalled=:FeeAmount=22.234567:Paid=
我想從使用Regex
或string.replace
此字符串中刪除:FeeAmount=22.234567
一部分。
它可以是空的是這樣的:
frmSearch=FeeType=RecordingSpend:LoginID=:PersonCalled=:FeeAmount=:Paid=
,或者它可以包含任何值
我嘗試這樣做:
變種STR = frmSearch.substr(frmSearch.indexOf(」 :FeeAmount「), frmSearch.indexOf(」:Paid =「));
我該如何使用正則表達式?
那你試試? – Prinzhorn
我一直在嘗試substring和string.replace組合,但他們不工作 – DotnetSparrow
@DotnetSparrow:顯示努力,所以人們可以幫助你找出你出錯的地方(所以這看起來不像是「請寫這個對我來說「問題)。 –