Find ! in document and remove

  • Thread starter Thread starter A.N.
  • Start date Start date
A

A.N.

How do I find all ! in a document where there is a lowercase letter on its
left and a space and lower case letter on its right and then remove it?

Example: end! another sentence

Thanks again.
 
I would find the exclaim mark and then look at each one to see if that's
what you want to remove. It is a bit tedious but that's what I can come up
with for now.
 
I have the find code correctly as this: ([a-z][!][spacebar][a-z])

How to write the replace code without the !

Thanks.
 
Yikes! You wrote that code yourself? in the VB editor? I don't know how to
use that as of yet.
Seen it all, done it all, can't remember most of it

A.N. said:
I have the find code correctly as this: ([a-z][!][spacebar][a-z])

How to write the replace code without the !

Thanks.
 
Solved. A basic part of code writing overlooked, pardon me, here it is for
others:

Example: ([a-z][!][spacebar][a-z])

Interpretation: will find the end of a presumed sentence or word with an !
then a space before a new sentence, however the next sentence was in
lowercase as well.

Sample: "end of a sentence! start of another"

I needed to remove the ! mark. The above code did work to find it as
prescribed, but I could not figure out how to remove the !.

Now for the miserably simple overlook. In all the examples it was not clear
what "\1" or "\2" meant. Place holder I guess, IF they are designated with
( ) brackets.

Corrected Example: ([a-z])([!])([spacebar-literally])([a-z]) Now each item
is enclosed in brackets.

There are four sets of brackets, therefore four place holders so-to-speak.

Replace code therefore is a simple - I want to keep brakets or space holders
\1\3\4 and wala, it worked. I imagine there is some redundancy in that
search code though. An expert could provide the most correct rendering.

-End


marrie said:
Yikes! You wrote that code yourself? in the VB editor? I don't know how to
use that as of yet.
Seen it all, done it all, can't remember most of it

A.N. said:
I have the find code correctly as this: ([a-z][!][spacebar][a-z])

How to write the replace code without the !

Thanks.


marrie said:
I would find the exclaim mark and then look at each one to see if that's
what you want to remove. It is a bit tedious but that's what I can come
up with for now.

--
This is a message from God: "Rebooting the universe, please log out"

How do I find all ! in a document where there is a lowercase letter on
its left and a space and lower case letter on its right and then remove
it?

Example: end! another sentence

Thanks again.
 
Find: ([a-z])[\!]([a-z])
Replace: \1\2

--
Enjoy,
Tony


A.N. said:
I have the find code correctly as this: ([a-z][!][spacebar][a-z])

How to write the replace code without the !

Thanks.
 
Oops - missed the space, sorry.

I see that you have solved it yourself and posted how - thank you.

It can however be simpler by only wrapping parentheses around the elements
you want to refer to, so:

([a-z])[\!]( [a-z])

\1 is the first parenthesised expression - the lowercase letter before the !
\2 is the second parenthesised expression - the space and lowercase letter
after the !

You will not be able to refer to the ! in the replacement - but you don't
want to :)

--
Enjoy,
Tony


Tony Jollans said:
Find: ([a-z])[\!]([a-z])
Replace: \1\2

--
Enjoy,
Tony


A.N. said:
I have the find code correctly as this: ([a-z][!][spacebar][a-z])

How to write the replace code without the !

Thanks.


marrie said:
I would find the exclaim mark and then look at each one to see if that's
what you want to remove. It is a bit tedious but that's what I can come up
with for now.

--
This is a message from God: "Rebooting the universe, please log out"

How do I find all ! in a document where there is a lowercase letter on
its left and a space and lower case letter on its right and then remove
it?

Example: end! another sentence

Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top