replace some text inside the quotes



  • friends how can i replace some text inside the quotes

    “concerto” “.uk” site:usa
    “maestro” + “.mx” + site:usa

    to

    “concerto” “.usa” site:usa
    “maestro” + “.usa” + site:usa



  • Hello,@Vivianjenylord

    Follow this step ,To replace some text inside the quotes

    Step 1:- First make sure “Replace straight quotes with Smart quotes” is ticked, on the “AutoFormat As You Type” tab under Tools + Autocorrect; and if you want to use a highlight in the replace, make sure the default highlight colour on the Reviewing toolbar is set to the colour you want.

    Step 2:- Then replace " with ", which will replace any straight quotes in the document with smart quotes.

    Step 3:- Now do your wildcard Find and Replace.
    Your “Find What” text needs to be:
    (“)(*)(”)
    Note that the quotes must be smart quotes: you can paste them from the document into the “Find what:” box.
    Your Replace with text needs to be:
    \2
    And in the “Replace with:” box, either select Format + Font + Italic, or Format + Highlight, depending on your preference.

    Step 4:- Finally, remove any orpaned opening smart quotes “ (as you might have if you’d had a quotation spanning more than one paragraph), by replacing the opening quote character (which, as before, you can cut and paste into the dialog from the document; don’t type it) with nothing.

    I hope this information will be usefull for you.

    Thank you.



  • Hello, @vivianjenylord,

    Your example is really too succinct. It’s impossible to come up with a valid rule.

    We need more information:

    • What is the general structure of each line?

    • What are the areas in double quotation marks, on each line, that need to be replaced ?

    • Does the replacement part have to be the same word as the one after the site: expression ?

    In other words, help us identify the problem and help you effectively !

    Best Regards,

    guy038



  • @guy038

    friends what I need is to change the text that is inside the quotes that have the country domains
    “.mx” to “.usa”
    “.ar” to “.usa”
    the other text that has quotation marks, those don’t, I tried with
    “[^”] + "

    WITH
    “.us”
    but change everything inside the quotes
    “Concerto” “.uk” site: use
    to
    “usa” “.usa” site: use and I don’t want that



  • @Vivianjenylord

    from the given example something like this could be the solution
    find:"\.\w+"(.*?site:)(\w+)
    replace:"\.$2"$1$2
    check regular expression in search mode



  • @Ekopalypse said in replace some text inside the quotes:

    “.$2”$1$2

    thank you very much friends, it worked

    thanks for interest in my problem



  • Hello, @vivianjenylord, @ekopalypse, and All,

    So I was on the right track when I asked my 3rd question !

    An alternative solution, if each line ends with the string site:...

    SEARCH \.\w+(?=.*?:(\w+))

    REPLACE .\1

    Best Regards,

    guy038



  • @guy038
    excellent my friend, thanks very much
    great guy038



  • Hello, @vivianjenylord and All,

    Some explanations on this regex S/R :

    • The part \.\w+ searches a literal dot character, followed with a non-null range of word chars…

    • But ONLY IF  the condition inside the look-ahead is True. That is to say if, further on, in current line, a colon followed with a second non-null range of word chars, stored as group1 as embedded in parentheses, can be found

    • In replacement, we rewrite a dot, followed with the contents of group1 ( the country name )

    Cheers,

    guy038


Log in to reply