replace with notepad

  • Hi,
    I need to replace all the sites with site:us

    site:it [number] phone2 value “source”: “Source A”
    “strength”: “0.7”, phone3 “Source D”
    “idTarget”: “1,253”


    site:us [number] phone2 value “source”: “Source A”
    “strength”: “0.7”, site:us phone3 “Source D”
    “idTarget”: “1,253” site:us


  • Hello, vilma-nety and All,

    Quite easy with regular expressions !

    • Open the Replace dialog ( Ctrl + H )

    • SEARCH (?-i)(?<=\bsite:)\.?\l\l

    • REPLACE us

    • Select the Regular expression search mode

    • Tick the Wrap around option

    • Click on the Replace All button,exclusively ( not the Replace one ! )

    Et voilà :

    Notes :

    • At beginning, the (?-i) modifier forces a non-insensitive to case search

    • The main part looks for an optional literal dot \.?, followed with a two lower-case letters \l\l, which represents the ccTLD ( Top Domains Level country code )

    Refer to :

    • But ONLY IF it is preceded with the word site, in this exact case, followed with a colon , due to the look-behind syntax (?<=\bsite:)

    Best Regards,


  • very grateful to you, guy038, I have been able to replace almost all, but those with site:net, the result is:


    I’m doing it with
    Open the Replace dialog ( Ctrl + H )
    REPLACE: site:us

    with regular expressions?
    infinitely thank you guy038

  • Hi, @vilma-nety and All,

    Ah! Sorry that my regex did not match all possible cases. I just thought that all your possible values, were like it, de, nz, … ! In other words, Internet country codes ( which, by definition, contain, all, two lower-case letters )

    So, in order to include vary common top-level domain names as .com, .net,…, the best method would be to simply consider all text, after site:, up to the first space character. Hence, this new search regex :

    SEARCH (?-is)(?<=\bsite:).+?(?=\x20)

    Notes :

    • The part .+? matches the shortest, non-null, range of standard characters, due to the -s modifier

    • ONLY IF followed with the first found space character, \x20, due to the look-ahead syntax (?=\x20). You may, simply, hit the space bar, instead of typing \x20



  • a thousand and a thousand thanks

Log in to reply