Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-17-2023, 12:58 PM
ctviggen ctviggen is offline Replacing "any character BUT a period then paragraph return" with space Windows 10 Replacing "any character BUT a period then paragraph return" with space Office 2016
Advanced Beginner
Replacing "any character BUT a period then paragraph return" with space
 
Join Date: Feb 2021
Posts: 54
ctviggen is on a distinguished road
Default Replacing "any character BUT a period then paragraph return" with space

We have text like this:


Start: {paragraph return}
line 1; {paragraph return}

line 2; {paragraph return}


ending line.{paragraph return}


That is, everything but the ending line could have a colon, semicolon, comma..., but ONLY the "ending line" has a period. This is the only period.


I want to end up with:


Start: line 1; line 2; ending line.{paragraph return}



I already have code that manipulates this for various reasons. I will add code that searches for "space ^p" (a space and then a paragraph return) and replaces with just "^p" (a paragraph return). I'll run this a few times, so that I should end up with "character ^p", each line ending with some type of character then an immediate paragraph return.


What I would like to implement is the following:


If the line does not end with a ".^p" but does end with a "^p", replace the "^p" with a space.



This removes the paragraph return from every line but those that end with a period and paragraph return.



I could "brute force" this by replacing all ";^p" with a space, all ",^p" with a space, ":^p" with a space.



But is there a more elegant way of doing this?
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Split apart "page break" and "paragraph mark" EwenMc Word 4 10-03-2021 02:12 AM
Replacing "any character BUT a period then paragraph return" with space Conditional tied to trying to find a " " space character Dart82 Word VBA 3 10-04-2013 01:47 PM
Wierd symbols inplace of "space", "indentation" etc aka.bhagvanji Word 5 02-16-2012 11:50 AM
Replacing "any character BUT a period then paragraph return" with space The heading doesn't "obey" the "before" space! why? Jamal NUMAN Word 1 07-06-2011 04:25 AM
Replacing "any character BUT a period then paragraph return" with space Replacing a single "l" with a double "ll" MShroff Word 8 01-19-2011 08:43 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:37 PM.


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