2013-04-23 119 views
0

我有任務交換連續塊的訂單,其中,I需要交換的命令:所以上面寫需要N ++正則表達式 - 交換訂單

<!--Validate first group--> 
    <lookupGroup name='Get 1st value '> 
     <Properties> 
      <select property='A' field='B[0]'/> 
     </Properties> 
    </lookupGroup> 
    <Include>..\Value\Test1.xml</Include> 
    <Include>..\Value\Test2.xml</Include> 
    <Include>..\Value\Test3.xml</Include> 
    <Include>..\Value\Test4.xml</Include> 

是在相反的順序:

<Include>..\Value\Test2.xml</Include> 
    <Include>..\Value\Test3.xml</Include> 
    <Include>..\Value\Test4.xml</Include> 

    <!--Validate first group--> 
    <lookupGroup name='Get 1st value '> 
     <Properties> 
      <select property='A' field='B[0]'/> 
     </Properties> 
    </lookupGroup> 
    <Include>..\Value\Test1.xml</Include> 

什麼是正確的語法呢?任何幫助,將不勝感激。先謝謝你。

+1

你有試過什麼嗎? – Piyuesh 2013-04-23 15:39:43

+1

'sequential block orders':你能詳細說明一下嗎.. – Anirudha 2013-04-23 15:41:17

+0

它是否總是從'<! - Validate first group - >'開始到你想要移動的第一個'Include'標籤的末尾?是否總是隻有4個'Include'標籤?如果沒有,是否有一些明顯的東西(甚至是任何不同的標籤都可以)? – Dukeling 2013-04-23 15:53:08

回答

0

此正則表達式適用於您的示例數據,並且每次單擊「替換」時,都會將Include元素移到lookupGroup之上。希望這可以幫助。

查找內容:(*<lookupGroup.*lookupGroup>.*\n)([^\n]*<Include>.*<.Include>)\n?

替換爲: 「」 \2\n\1

對於這個工作,你必須有設置爲匹配換行符。