Sometimes I get docs from users that do not use the space bar after a comma, e.g. "Look,this is an example."

In Word 2003, is there any search wildcard that I can use to find those occurences?

I have tried ,? and ,* without success, also ,\? and ,\* are not working.

up vote 9 down vote accepted

I can tell you a simpler way.
Just replace all , with ,<space> where <space> means a blank space and then replace ,<space><space> with ,<space> to account for places where users did put a space after comma.

WARNING: If you use commas in numbers (either as thousand separator or decimal separator), you need to go through the document to correct numbers such as "1,200" which will now be rendered as "1, 200" .

  • 2
    Why do you mean that this way is simpler? It takes two steps instead of one ;) – duDE Aug 4 '14 at 12:10
  • 5
    Perhaps not simpler, but this is much easier to remember than [!<]?,[!>]? especially if you're not familiar with RegEx's. I'd have several steps when using the top one - find Notepad doc with string (or open this SE page), copy string, paste string, run. Don't think I'd trust my brain to recall it by heart for at least the first few times. – Kai Aug 4 '14 at 15:05
  • 1
    The other answer is really interesting, I'm not a Word guru but it is neat to know it supports some RegEx out-of-the-box, so to speak. This one though is also a great answer too for its simplicity. – David Zemens Aug 5 '14 at 3:54
  • I have chosen this answer as the best answer because the solution of duDe does not work with Word 2003 which was specifically asked for. Thanks @tumchaaditya for this nice hack. – Kai Noack Aug 5 '14 at 4:22

You can use this pattern:

[!<]?,[!>]?

That means: find a comma character between any characters, just not at the beginning of the word and not on the end of the word.

So that in the example below, one would find only the comma at "3,a" (but NOT those at: ",1" and "c,")

,123,abc,
  • Is THAT valid for MS WORD? If YES: Where do I find more info on this? – Hannu Aug 4 '14 at 11:23
  • 1
    Yes it is. office.microsoft.com/en-us/help/… – duDE Aug 4 '14 at 11:24
  • 11
    Thanks. I've always considered the search function in Word ' deficient' - now I found out it was my knowledge that was deficient. – Hannu Aug 4 '14 at 11:30
  • @Hannu: Glad to help! If you found the answer helpful fill free to upvote it ;) – duDE Aug 4 '14 at 11:39
  • 2
    @duDE Worked for me in Word 2010 as long as I had "Use wildcards" selected/checked – Halfwarr Aug 4 '14 at 21:04

To search and correct for commas not followed by a space. Check 'Use wildcards' and use following:

Find what: (,)([! ])
Replace with: \1 \2

(Note: There is a space after '!' in Find what)

If your text contains CTL languages/scripts (like Hindi/Devanagari) above does not work (don't know why?), use this instead (will also work with Latin script languages):

Find what: (,)([! ]?)
Replace with: \1 \2

If your text contains poetry then comma may appear at the end of lines (in the stanza), it should not be followed by space, so condition should be added to avoid commas at the end of lines:

Find what: (,)([! ^l]?)
Replace with: \1 \2

If commas appearing at the end of paragraphs should also be avoided then add ^13 (paragraph mark) with ^l, however there is low possibility for this, it is only possible when the typist had given paragraph breaks (instead of line breaks) at the end of each line.

One more case, if your text contains numbers containing comma (to indicate hundred's, thousand's separator) use this to avoid unwanted such commas:

Find what: ([!0-9],)([! ^l][!0-9])
Replace with: \1 \2

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.