Replacing Notepad ++ regular expression

Hello I have a large file and I need to replace some values, so I have to use a regex: can anyone help me and tell me how to do this?

<FieldRef ID="{FE652450-8A96-416E-AAE4-F85BE196A249}" Name="CG"  DisplayName="CG"/>
  <FieldRef ID="{AAA6ABCD-CE07-4D0E-A689-773DD47F4D64}" Name="Statut"  DisplayName="Statut"/>
  <FieldRef ID="{F13A3B87-47DE-4DE2-B480-FE1126B0D5E2}" Name="ElementCMin"  DisplayName="Element C Min"/>

      

So in these lines, I need to replace ID = "{guid}" with an empty string.

+3


source to share


2 answers


Try to run



ID="{[a-zA-Z0-9-]+}"

      

+7


source


This regex should

ID="\{.*\}"

      

Replace with an empty string and you're done. However, if you have more cases of something ending in }"

, notepad will do the wrong thing by applying the replace function on that line

text1 ID="{F13A3B87-47DE-4DE2-B480-FE1126B0D5E2}" 
text ID="{F13A3B87-47DE-4DE2-B480-FE1126B0D5E2}" text2

      

will delete everything except



text1 text2

      

however have a look at Notepad ++ non greedy regexp if you need to fix this problem.

EDIT: If you have notepad ++ version 5.9 or greater then the regex for the tuple is

ID="\{.*?\}"

      

It stops at the first curly brace on the line

+1


source







All Articles