Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-18-2017, 03:54 PM
jeffreybrown jeffreybrown is offline Add a return between two square brackets Windows Vista Add a return between two square brackets Office 2007
Expert
Add a return between two square brackets
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

Hi slaycock,



Didn't quite get the results I expected. First, it does not handle the space between the open and close square bracket. I removed the space and the f/r did run, but was hoping the find and replace could pick up the ] space [ pattern.

However, by removing the space, one of the open square brackets gets changed to a close square bracket on the new line instead of the results in post #1.

[Proverbs 4:26 NASB]
]26] Watch the path of your feet And all your ways will be established.
[Proverbs 18:19 NASB]
]19] A brother offended is harder to be won than a strong city, And contentions are like the bars of a citadel.
[Proverbs 11:29 NASB]
]29] He who troubles his own house will inherit wind, And the foolish will be servant to the wisehearted.
Reply With Quote
  #2  
Old 02-19-2017, 03:34 AM
slaycock slaycock is offline Add a return between two square brackets Windows 7 64bit Add a return between two square brackets Office 2013
Expert
 
Join Date: Sep 2013
Posts: 255
slaycock is on a distinguished road
Default

My Apologies there is a typo in the first replace text (That's happening a lot at the moment as I have a new keyboard)

\1^p\1

should read
\1^p\2

which I did get right further down the page. My old eyes missed the space between the ] and [

The revised search would be

([\]])(*)([\[])

Personally I find the search text quite hard to scan, particularly on my hi res monitor where the search and replace dialog box is tiny.

So on reflection an easier to read version would have been

([^091])(*)([^093])

where 091 and 093 are the decimal ascii codes for [ and ].

You can get more information on find and replace using wildcards by clicking the ? on the find and replace dialog box and first looking under

Search by using wildcards

and then

Find and replace text by using regular expressions (Advanced)
Reply With Quote
  #3  
Old 02-19-2017, 07:49 AM
jeffreybrown jeffreybrown is offline Add a return between two square brackets Windows Vista Add a return between two square brackets Office 2007
Expert
Add a return between two square brackets
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

Thanks slaycock for the additional help...

Using...

Find What: ([^091])(*)([^093]) >> Use Wildcard checked
Replace: \1^p\2

I get six replacement where I would only expect three

The following is what is returned...

[
Colossians 3:19 NASB [
19 Husbands, love your wives and do not be embittered against them.

[
Ephesians 3:21 NASB [
21 to Him be the glory in the church and in Christ Jesus to all generations forever and ever. Amen.

[
Ephesians 5:33 NASB [
33 Nevertheless, each individual among you also is to love his own wife even as himself, and the wife must see to it that she respects her husband.

Is it possible to just look for the [ followed by a number and generate the return just before that string?
Reply With Quote
  #4  
Old 02-19-2017, 08:24 AM
slaycock slaycock is offline Add a return between two square brackets Windows 7 64bit Add a return between two square brackets Office 2013
Expert
 
Join Date: Sep 2013
Posts: 255
slaycock is on a distinguished road
Default

What you are seeing is the ongoing demonstration of my lack of checking due to haste (I'm actually working at home this weekend fighting a deadline).

What has happened is that we have two errors. One in the find field and one in the replace field.

In the find field we have the ][ the wrong way round. The find field should be
([^093])(*)([^091] not ([^091])(*)([^093]


The error in the replace field comes adding the (*) to the search text. We now have three fields defined by () (Smacks head on wall several times because checking back I can see that my attempt at () in our earlier discussion came out as 9 0. This is because my new keyboard has the number and symbols the wrong way round so my brain types ( but my reflexes type 9 because 9 is above the ( on my new (soon to be ebayed) keyboard)

By inserting the (*) your bracket fields have now become fields 1 and 3. By using fields 1 and 2 in the replace text we are replacing the found text with the [ (in this case) and the text found by the (*) (which in this case is everything between the [ and ])



So changing the replace text to \1^p\3 should now get us to the place where you want to be.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Add a return between two square brackets Bold numbers between square brackets jeffreybrown Word 4 02-13-2017 04:32 PM
Add a return between two square brackets Help with: Replace and reformat numbers inside square brackets johnbrowny Word 1 02-13-2016 06:45 PM
Gray square brackets waldux Word 8 09-25-2013 04:14 PM
Add a return between two square brackets square brackets and grey background – why? eNGiNe Word 2 11-21-2012 01:06 AM
Add a return between two square brackets Filled square daksein Drawing and Graphics 4 06-21-2011 02:36 AM

Other Forums: Access Forums

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