Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-10-2020, 01:29 PM
Peterson Peterson is offline Applying styles via wildcard search not working as expected Windows 10 Applying styles via wildcard search not working as expected Office 2019
Competent Performer
Applying styles via wildcard search not working as expected
 
Join Date: Jan 2017
Posts: 141
Peterson is on a distinguished road
Default Applying styles via wildcard search not working as expected

I'm trying to use a wildcard string (below) to find unformatted text and apply a style to it. The string finds exactly what I'm looking for, but Word is applying the style to the *prior* paragraph, too, even though the Replace with field is set to just the second grouping in the wildcard string.
  • Find what: (^13)([0-9]{2}^t*^13)



  • Replace with: \2
    Style: Heading 1
I have to have the initial paragraph mark because the string will otherwise find instances of text that I'm not looking to apply the style to.

What am I doing wrong? I've restarted Word, thinking that I needed to shake out some residual weirdness in the Find/Replace, to no avail.
Reply With Quote
  #2  
Old 12-10-2020, 03:45 PM
Guessed's Avatar
Guessed Guessed is offline Applying styles via wildcard search not working as expected Windows 10 Applying styles via wildcard search not working as expected Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,969
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

The Replace command is working on the entire found component which includes the paragraph mark from the preceding content, hence the preceding paragraph getting the style applied.

There may be another more direct way but the method I would normally use involves three steps:
1. Use your current find and include some unique text in the replace without applying formatting. eg replace with "zxzx\2"
2. Find the unique text and replace it with the style formatting
3. Remove the unique text.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 12-10-2020, 06:16 PM
Peterson Peterson is offline Applying styles via wildcard search not working as expected Windows 10 Applying styles via wildcard search not working as expected Office 2019
Competent Performer
Applying styles via wildcard search not working as expected
 
Join Date: Jan 2017
Posts: 141
Peterson is on a distinguished road
Default

Ah, another use of the ol' "temporary dummy string" method -- I'm partial to QQ.


Thanks, Andrew!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Applying styles via wildcard search not working as expected Tabbing not working as expected? PhoenixJames Word 2 08-30-2019 01:52 PM
Styles and not applying correctly GinnyBcore Word 1 10-02-2018 03:18 PM
Creating bullet animations not working as expected stpwaddell PowerPoint 1 01-04-2017 03:10 AM
Applying styles dynamically? arkofcovenant Mail Merge 1 05-08-2015 06:02 AM
Wildcard search help. Kempston Word 0 11-13-2009 03:58 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:56 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