*Help* How to change multiple unknown text string with just one?

  • Hello everybody!
    I hope you are all alright and healthy.

    So, I’ve searched for this on Google and on this Forum and haven’t been able to find it. Either that, or the solutions I found didn’t work for me (probably because I’m just too dumb).

    So, I have a big XML file in which I have multiple strings with a constant text, followed by different strings.
    I’d like to keep that constant text and change all of the different options that follow, with another new constant text.

    For example -
    Example 1: <property name=“Name” type=“string” value=“Iso”/>
    Example 2: <property name=“Name” type=“string” value=“Bin”/>
    Example 3: <property name=“Name” type=“string” value=“Wire”/>
    Example 4: <property name=“Name” type=“string” value=“Whatever”/>

    And I’d like to change the Iso, Bin, Wire and Whatever for: HELLO.
    Obviously, all of those lines are in different places of the file, and there are many more. I just simplified the task at hand for the sake of simplicity.

    I hope you can help a newbie out.

    Thank you all in advance.

  • Hello, @chuny_ok and All,

    No problem, with regular expressions ! So :

    • Open the Replace dialog ( Ctrl + H )

    • SEARCH (?-s)<property name="Name" type="string" value="\K.+(?="/>)



    • SEARCH (?-s)(<property name="Name" type="string" value=").+

    • REPLACE \1HELLO"/>

    • Tick, preferably, the Wrap around option

    • Select the Regular expression search mode

    • Click on the Replace All button ( Do not use the step by step Replace button, with the first S/R ! )

    If OK, I could develop how these regexes work, next time ;-))

    Best Regards,


  • or for custom replace another idea is

    find what:Iso|Bin|Wire|Whatever
    replace with:HELLO
    Select the Regular expression mode

  • Hi, @chuny_ok, @gurikbal-singh and All,

    Of course, your S/R, @gurikbal-singh, is more simple and obvious but could grasp too many occurrences, as it does not care about the tags and the attributes involved, with the same value :-((

    But I admit, that in case of few found occurrences, the use of the step by step replacement, with the Replace button, after verification, may be enough for @chuny_ok !

    Best Regards


  • Thank you @guy038 and @gurikbal-singh
    I tried with your suggestions and all of them worked.
    Much appreciated!
    Thanks again!

  • @guy038 Hello my friend, I have another one for you!
    Now, I’m not sure if this is possible at all but, let’s try.

    I have several blocks within an XML file
    They are a little something like this

    <property name=“Evaluator” type=“int” value=“4”/>
    <property name=“zoomValue” type=“float” value=“0.8”/>
    <property name=“Framingn” type=“int” value=“2”/>
    <property name=“Name” type=“string” value=“High”/>
    <property name=“PropertyName” type=“string” value=“Whatever”/>

    Like I said, there are many blocks like that in different places of the same XML but with different values, different properties, etc.
    But they are all within the <Instance> </Instance> tags.

    I’d like to replace all of them, not matter the content inside those tags with only one <Instance> </Instance> of my own.
    Obviously, doing that one by one would take about two hours since there are probably between 70 and 100 I’d need to change. So is there any way to do what I’m after?.

    Thank you very much in advance.

  • Hi @Chuny_OK

    -Try this:

    Open the Replace dialog (Ctrl + H) and type in:

    Search: (?s)(<Instance>).*?(</Instance>)
    Replace: $1HELLO$2

    Replace "HELLO" with your string.
    Check the Wrap around option
    Select the Regular expression search mode
    Click on the Replace All button

  • @astrosofista said in *Help* How to change multiple unknown text string with just one?:


    Thank you! It worked like a charm!
    Thank you for your quick reply too!

  • @Chuny_OK

    You’re welcome. If you want to get involved in regex, let me suggest you to take a look at this page:


    Have fun!

Log in to reply