Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-09-2017, 01:22 AM
ChrisRick ChrisRick is offline Wildcards used for Search and Replace Windows 7 64bit Wildcards used for Search and Replace Office 2010 64bit
Novice
Wildcards used for Search and Replace
 
Join Date: Mar 2017
Posts: 2
ChrisRick is on a distinguished road
Default Wildcards used for Search and Replace

Hello

I am trying to perform a search for any character immediately followed by a hyphen (ie no space) and replace it with the same character followed by a space and a hyphen:


Search for "?-" and replace with "? -" where the ? is a wildcard. However everytime I perfrom the search the wild card character is replaced with "?". eg search for "2015-" is being replaced with "201? -" It should read "2015 -". Is there a way to do this using the find and replace facility?
Reply With Quote
  #2  
Old 03-09-2017, 01:48 AM
ChrisRick ChrisRick is offline Wildcards used for Search and Replace Windows 7 64bit Wildcards used for Search and Replace Office 2010 64bit
Novice
Wildcards used for Search and Replace
 
Join Date: Mar 2017
Posts: 2
ChrisRick is on a distinguished road
Default

Solved it, I used
Find = (?)-
Replace = \1 -
Reply With Quote
  #3  
Old 03-09-2017, 05:01 AM
macropod's Avatar
macropod macropod is offline Wildcards used for Search and Replace Windows 7 64bit Wildcards used for Search and Replace Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Your Find/Replace would, amongst other things, replace a single space with a pair of spaces. You'd probably do better to use something like:
Find = ([0-9A-Za-z])-
Replace = \1^s-
As coded, my version ensures there's actually a letter or number before the hyphen, then inserts a non-breaking space before it - which ensures the hyphen doesn't end up starting a new line.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wildcards used for Search and Replace best way to use search/replace wildcards in this scenario? dylansmith PowerPoint 3 03-04-2023 08:55 PM
Wildcards used for Search and Replace newb - search and replace - WILDCARDS - keep original...? Bansaw Word 4 09-01-2016 11:16 AM
Wildcards used for Search and Replace Search and Replace special characters between word using wildcards mauuuuu5 Word 1 08-23-2015 09:20 PM
Wildcards used for Search and Replace Search with wildcards imag Word 1 11-05-2014 11:42 PM
Any wildcards search and replace in Powerpoint 2010? tinfanide PowerPoint 0 09-10-2011 02:17 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:19 PM.


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