Results 1 to 9 of 9
  1. #1
    Star Lounger
    Join Date
    Jan 2003
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Replace single quotes with double quotes (Word 2000 SP3)

    I need to replace single quotes with double quotes in a large document. However I can't do a simple search and replace because I don't want to replace all of the apostrophes in the document. Is there any way to do this, perhaps with a macro?

    To clarify, I want to change as follows:

    BEFORE: I'm still searching for a 'real' bagel in Massachuetts.
    AFTER: I'm still searching for a "real" bagel in Massachusetts.

    Sometimes the single quotes to be replaced enclose a phrase, rather than a single word.

    I think I want to replace every instance of single quotes except a) letter-apostrophe-letter (e.g. I'm, they're, don't, etc.) [img]/forums/images/smilies/cool.gif[/img] s-apostrophe-space (e.g. plural possessives like: writers' ) and c) number-apostrophe-s (e.g. 1990's), but I may be missing something.

    Many thanks in advance for any suggestions.

    regards,
    Abe

  2. #2
    Bronze Lounger IanWilson's Avatar
    Join Date
    Dec 2000
    Location
    Bristol, United Kingdom
    Posts
    1,523
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Replace single quotes with double quotes (Word 2000 SP3)

    It seems to me that the things you do need to replace are [space]' replaced with [space]", and '[space] with "[space], and '. replaced with ". It wouldn't take too many search and replaces to do all that, would it? Oh and perhaps other punctuation marks too after the apostrophe, like '? replaced with "?

    Ian

  3. #3
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Replace single quotes with double quotes (Word

    Hi Abe:
    I think you could try this. Using wildcards,
    Find: <'(*)'>
    Replace: "1"
    This will search for a string that starts & ends with an apostrophe & replace those apostrophes with quotes. It won't replace apostrophes that are used in contractions. However, I haven't thought through every single permutation, so I would try this on a copy of the document. I guess it wouldn't work if you had a sentence like:

    You ain't seen nuttin' <font color=red>'til you've seen nuttin'</font color=red>. The part in red would then be enclosed in quotes. To exclude anything that ended in a word like <font color=red>writers'</font color=red>, you could use:

    <'(*)[!s]'>

    in the Find box.
    Attached Images Attached Images

  4. #4
    5 Star Lounger
    Join Date
    Oct 2002
    Location
    Wellington, Wellington, New Zealand
    Posts
    621
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Replace single quotes with double quotes (Word 2000 SP3)

    There is a convoluted method that will work 99% of the time.

    Step 1 - identify all apostrophies and convert their font colour e.g. to blue

    Step 2 - identify and replace all single quotes with double quotes where font colour is still automatic

    Step 3 - change font colour blue back to automatic

    In step one, to search for apostrophies look for {Any letter}'{any letter} - this gets most apostrophy forms other than leading and training ones.
    Note that these will then appear as spelling errors = e.g. "tis will be identified as an error.

  5. #5
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Replace single quotes with double quotes (Word 2000 SP3)

    This kind of technique is very useful at times - for instance reformatting text containing linebreaks. It's much easier though (where possible) to use an unused, obscure character for the first replacement i.e. for the characters you need to preserve, but mask in order for the second replacement to work as intended.

    For instance, replace <^$>'<^$> with "1"^0170"2"
    This will replace all apostrophes sandwiched between letters with the [b]

  6. #6
    5 Star Lounger
    Join Date
    Oct 2002
    Location
    Wellington, Wellington, New Zealand
    Posts
    621
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Replace single quotes with double quotes (Word 2000 SP3)

    My head hurts. I tried the find string you indicated and didn't find anything. I had a look at wildcards in help.
    On a first read I thought that the syntax should have been (^$)'(^$) for the find string - but on a test, couldn't make the find work unless I set wildcards, and then the ^$ wouldn't work.
    My head hurts even more <img src=/S/dizzy.gif border=0 alt=dizzy width=15 height=15> . Canya give me a dummies guide to this please. <img src=/S/confused.gif border=0 alt=confused width=15 height=20>

  7. #7
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Replace single quotes with double quotes (Word

    Hi Andrew:
    No need to hurt your head. <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15> You are correct that ^$ only works without using wildcards. I think Alan was just trying to demonstrate a modification of the technique that you mentioned...using a string instead of a change in font color. Either will work in the appropriate situation.

    e.g. One common use of a string is to replace paragraph markers at the end of every line when you paste text from a text editor. Then you would do 3 Find/Replaces (w/o using wildcards):
    1. Find: ^13^13
    2. Replace with: %%%
    3. Find: ^13
    4. Replace with: space
    5. Find: %%%
    6. Replace with: ^p

    Or you could use your method:
    1. Find: ^13^13
    2. Replace with: font color orange
    3. Find: ^13 font color auto
    4. Replace with: space
    5. Find: font color orange
    6. Replace with: ^p & auto color

    In that situation, the string replacement is probably easier to use, but I can see situations where it would be easier to use a font color or even highlight. Provided you have no other highlight in your document, using highlight has the advantage of having an option to search or replace for "not highlight", whereas you can't search for "not brown".

    Hope I haven't made your head hurt worse. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

  8. #8
    5 Star Lounger
    Join Date
    Oct 2002
    Location
    Wellington, Wellington, New Zealand
    Posts
    621
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Replace single quotes with double quotes (Word

    Thanks Phil - no it doesn't hurt more.

    I already knew how to do text replacement and paragraph marker replacements (although I always use the replacement string XYZZY in memory of the game 'adventure')

    I guess my confusion was that my post was an attempt to solve the posted problem - I don't normally use a font change either - but it was the only way I could see to make it work to flag apostrophies - if Alan has another method for this case, I'm keen to learn it <img src=/S/grin.gif border=0 alt=grin width=15 height=15> - I'm guessing there is some wildcard variation.

  9. #9
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Replace single quotes with double quotes (Word

    Sorry about the headache Andrew. I do concur with Phil, that my ^$ solution won't work with wildcards in Word. I use a program that uses regular expressions on text-based files, where an equivalent operation does work, and I confused the two. My fault for not trying before posting! Phil was also right in assuming that I was just trying to demo the same principle as you, but using a (more easily spotted/ reversible) unique character as a marker.

    Alan

    Pretty poor effort on the part of MS, BTW. It wouldn't be much of a programming challenge to capture an identified letter to a temporary variable IMO!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •