Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-08-2015, 08:57 AM
BruceM BruceM is offline Wildcard Find and Replace anomaly Windows 7 64bit Wildcard Find and Replace anomaly Office 2010 32bit
Advanced Beginner
Wildcard Find and Replace anomaly
 
Join Date: Feb 2015
Posts: 41
BruceM is on a distinguished road
Default Wildcard Find and Replace anomaly

I have come across what seems to be a Find and Replace anomaly using wildcards. Trying to replace <period><space> with <period><space><space>. Please note that I do not agree with the current "rule" that there should be just one space after a period.



The Find string is (one space between the parentheses):
(.) ([A-Z])
I have also tried:
(. )([A-Z])
and also looked for something other than a space after <period><space>
(. )([! ])

Using the first Find example above, the Replace string is (two spaces between \1 and \2):
\1 \2

Working with the following:

One sentence. Another sentence.

Find correctly highlights ". A". However, the Replace produces this:

One sentence.A nother sentence. (two spaces between "A" and "n")

Can anybody tell me what's going on here?
Reply With Quote
  #2  
Old 07-08-2015, 02:02 PM
Robert2 Robert2 is offline Wildcard Find and Replace anomaly Windows 8 Wildcard Find and Replace anomaly Office 2007
Competent Performer
 
Join Date: Jun 2013
Posts: 174
Robert2 will become famous soon enoughRobert2 will become famous soon enough
Default

There is no anomaly at all!

As a “wild card”, [A-Z] will only match one single uppercase character.

Note that trying to locate <period><space> as an end of sentence marker is always a bit of a wild goose chase. There are tons of abbreviations, acronyms, etc., followed by <period><space>.

However, you might want to try the following wildcard Find/Replace:

Find What: (.^32)([A-Z][a-z]{1,})
Replace With: \1^32\2
Reply With Quote
  #3  
Old 07-08-2015, 03:29 PM
macropod's Avatar
macropod macropod is offline Wildcard Find and Replace anomaly Windows 7 64bit Wildcard Find and Replace anomaly Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,355
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You should be able to use a wildcard Find/Replace, where:
Find = (. )([A-Z])
Replace = \1 \2
or:
Find = (.) ([A-Z])
Replace = \1 \2
or:
Find = (.)( [A-Z])
Replace = \1 \2
Find = (. )([! ])
Replace = \1 \2
and so on. None of these is capable of producing 'One sentence.A nother sentence.' There is also no need to complicate things with extra parameters or escape codes.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 07-10-2015, 04:33 AM
BruceM BruceM is offline Wildcard Find and Replace anomaly Windows 7 64bit Wildcard Find and Replace anomaly Office 2010 32bit
Advanced Beginner
Wildcard Find and Replace anomaly
 
Join Date: Feb 2015
Posts: 41
BruceM is on a distinguished road
Default

Today it works. I have often used wildcard find and replace successfully, including the situation I described. The day I posted I was getting the erratic results. I spent some time on it before posting, as I was sure I had missed something. All I can say is that I am certain I was doing it as I described, with the result I described, but now it works as expected.

"As a 'wild card', [A-Z] will only match one single uppercase character."
That was my intent. I was looking for a period followed by a space followed by any upper case character. The Find highlighted that combination. I realize there are abbreviations and other situations where I would not want the extra space, so I was stepping through the document and replacing as appropriate (except I was sidetracked by the the oddity that appeared that day). I had restarted Word, but got the same result. I didn't try a computer restart, but I should have done so before posting. I have seen oddities appear temporarily with Word and other Office products (and not limited to MS programs). All I can think is that this must have been one of those.

Anyhow, thanks for the replies. I appreciate both of you taking time to respond.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wildcard Find and Replace anomaly New Find/Replace Wildcard Needed rsrasc Word VBA 2 11-11-2014 09:46 AM
Wildcard Find and Replace anomaly Find/Replace Wildcard Needed rsrasc Word VBA 4 11-11-2014 08:28 AM
Wildcard Find and Replace anomaly Wildcard Find and Replace Ulodesk Word 1 06-23-2014 10:26 AM
Wildcard Find/Replace deletes extra character Cosmo Word 1 06-20-2014 08:49 AM
Wildcard Find and Replace anomaly Need help using WildCard Find & Replace Cayce Word 1 06-09-2014 04:17 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:35 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft