locked
replacing all pairs of single quotations with double quotations pairs RRS feed

  • Question

  • hi friends

    i have a powershell script in which in many places i have different words which are enclosed in double quotations ---->  for example  'running'  ,  'status'  , etc.

    so i need to find all words which is have this structure 'word' & replace two single quotation with two double quotations.

    for example i need 'running' becomes "running".

    i don't know what to write in find what and replace with fields when pressing Ctrl+H.

    i tested '*' be replaced with "*" but didn't work.

    also please introduce me resources which i can learn some tricks to find such custom needs.

    really thanks


    • Edited by john.s2011 Friday, October 24, 2014 10:57 AM
    Friday, October 24, 2014 10:17 AM

Answers

  • In the Replace dialog, click More >>, then tick the check box 'Use wildcards'.

    Enter <'(*)'> in the 'Find what' box, and "\1" in the 'Replace with' box.

    Click 'Replace All'.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by john.s2011 Friday, October 24, 2014 1:57 PM
    Friday, October 24, 2014 12:06 PM

All replies

  • In the Replace dialog, click More >>, then tick the check box 'Use wildcards'.

    Enter <'(*)'> in the 'Find what' box, and "\1" in the 'Replace with' box.

    Click 'Replace All'.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by john.s2011 Friday, October 24, 2014 1:57 PM
    Friday, October 24, 2014 12:06 PM
  • In the Replace dialog, click More >>, then tick the check box 'Use wildcards'.

    Enter <'(*)'> in the 'Find what' box, and "\1" in the 'Replace with' box.

    Click 'Replace All'.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    hi Hans

    thanks a lot, but that works only for words which are at the beginning of the line.

    for any other words which are not first word at the line, it works in such way: 

    'status'  'running'    ------>  "status"  "'running'"


    Friday, October 24, 2014 2:01 PM
  • Make sure you use it exactly as I stated - it works fine for me, whether the words are at the beginning, in the middle or at the end of a line/sentence/paragraph.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Friday, October 24, 2014 2:21 PM