2013-11-28 18 views
1

我用崇高的文本3 我有這樣的正則表達式。崇高盾牌號碼替代?

<farm_plot id="260" x="29" y="8" input_fill="0" output_fill="0"/> 

我需要設置input_fill="1"和替換output_fill="0"extra_input="203001"

查找內容系大XML文件:(<farm_plot .* input_fill=")(.)(".*)(output_fill="0")(.*)/>
替換爲:$1$3extra_input="203001"$5/>

它代替了罰款,但我不能設置input_fill="1"。因爲如果我寫:
替換爲:$11$3extra_input="203001"$5/> 它認爲,我想要11美元。

我可以增加空間,但它看起來醜陋:
替換:$1 1$3extra_input="203001"$5/>

結果:<farm_plot id="260" x="29" y="8" **input_fill=" 1"** extra_input="203001"/>

問:我怎麼能寫$ 1.1,$ 2沒有空間?

+0

可以使用{$ 1}在你的替換表達 – Richard

回答

1

正確答案是:

${1}1$3extra_input="203001"$5/> 
0

只需移動一些非數字數據即可強制分離1。

查找: (<farm_plot .* input_fill=)(".")(.*)(output_fill="0")(.*)/>

替換: $1"1"$3extra_input="203001"$5/>

+0

這個變種是增加了干擾 「」:'input_fill = 「」 1 「」' –