Copy link to clipboard
Copied
I'm just starting to utiilize GREP a little and was trying to write an expression the would find two or more uppercase or uppercase, lowercase, uppercase combination followed by a period such as MD., Phd., FAAC. etc. I'm attempting to to find those instances and remove the period so that it reads MD, PhD, FAAC etc.
I came up with (\u\u|\u\l\u+)\. which works OK except that it also finds anything with 2-3 uppercase letters at the end of a sentence as well, which I dont' want.
I also used $1 in the change to box to capture the phrases which seems to work fine as well.
I would really just like to not find anything at the end of a sentence.
Maybe something with lookahead or lookbehind. That's confusing me as well.
Thanks for any help in advance.
Hi dgriffin1951,
sorry, my english is too bad. In my opinion you are not looking for »MD., PhD., FAAC.« but the dot after »MG or PhD or FAAC«
But perhaps this could be helpful:
use Grep find&replace
Find:
(?<=,\s\u)([\l\u]{1,3})(\.)(?=(,|$))
replace with:
$1
It's a little bit tricky, because of the most other greps are also find »St.« in »Inc., St. Louis, MI«
Please give a response.
Copy link to clipboard
Copied
Hi dgriffin1951,
you can try something like this:
\b\u[\l\u]{1,3}\.(?!$)
Pre CC this also should do:
\<\u[\l\u]{1,3}\.(?!$)
This will always find words with up to four letters which are not at the end of a paragraph.
(Sometimes it's also important to know your InDesign version.)
Have fun
Copy link to clipboard
Copied
Hello dgriffin1951,
(\u{1,4}|\u\l\u+)\.(?=.)
This requires one character after the period. Problem is that there can be a space in the end of a sentence.
if you change it to
(\u{1,4}|\u\l\u+)\.(?=[^ ])
it doesn't find "FAAC. " (with extra space) but instead "FAAC." in the end of a sentence. ([^ ] means "not space")
Perhaps you can remove the extra space(s) with <space>+$ or
\s+$, which finds all sorts of white space in the end of a sentence but also removes the last line break (\r) if there is one.
Olli
Copy link to clipboard
Copied
Hi,
For me main questions are:
Jarek
Copy link to clipboard
Copied
Hi Jump_Over,
For me main questions are:
- Is your searched text built as "1-sentence" paragraph?
- How can you differ "end of sentence period" and "unwanted period"?
- Is it true that "unwanted period" is followed by space and lowercase?
I'm with you.
Before I continue in the crystal ball reading ... dgriffin1951 please give us a meaningful text example with the most of your »two or more uppercase or uppercase, lowercase, uppercase combination followed by a period« in the middle of a lot of sentences and also at the end of some sentences!
Copy link to clipboard
Copied
pixxel schubser:
Great idea. Here is a sample of the text. I need to eliminate all the periods after the Titles but leave the commas if they are there but I don't want to remove the periods if they happen to appear at the end of sentence. Hope this is clearer. Thank you all for helping out.
d.
Author(s):
Erik Wissner, MD., FACC
Sebastian Deiss, MD.
Tilman Maurer, MD.
Michael Botros, MD.
Karl-Heinz Kuck, MD., PhD., FACC
Introduction | Objectives:
Catheter ablation of atrial fibrillation (AF) using magnetic navigation is feasible with similar long-term success rates, but typically more time-consuming than manual ablation. The 3. generation magnetic navigation system (EPOCH, Stereotaxis Inc., St. Louis, MI) allows for improved catheter response times potentially shortening procedure duration. We compared procedural data using the EPOCH system with previously published data from our laboratory using the 2. generation system for catheter ablation of AF.
Methods:
Catheter ablation of atrial fibrillation (AF) using magnetic navigation is feasible with similar long-term success rates, but typically more time-consuming than manual ablation. The 3. generation magnetic navigation system (EPOCH, Stereotaxis Inc., St. Louis, MI) allows for improved catheter response times potentially shortening procedure duration. We compared procedural data using the EPOCH system with previously published data from our laboratory using the 2. generation system for catheter ablation of AF.
Copy link to clipboard
Copied
Hi dgriffin1951,
sorry, my english is too bad. In my opinion you are not looking for »MD., PhD., FAAC.« but the dot after »MG or PhD or FAAC«
But perhaps this could be helpful:
use Grep find&replace
Find:
(?<=,\s\u)([\l\u]{1,3})(\.)(?=(,|$))
replace with:
$1
It's a little bit tricky, because of the most other greps are also find »St.« in »Inc., St. Louis, MI«
Please give a response.
Copy link to clipboard
Copied
Hi Pixxxel,
As I understand, just search in the authors list.
Find: \.(?!\s)
Replace by: nothing
Copy link to clipboard
Copied
Obi-wan Kenobi schrieb:
Hi Pixxxel,
As I understand, just search in the authors list …
Oh, this could be possible.
But the list is not a sentence???
What outcome is desired really?
This one:
xxxx xxxxxx, MD, FACC
xxxxxxxxx xxxxx, MD.
xxxxxx xxxxxx, MD.
xxxxxxx xxxxxx, MD.
xxxx-xxxxx xxxx, MD, PhD, FACC
Or this one:
xxxx xxxxxx, MD, FACC
xxxxxxxxx xxxxx, MD
xxxxxx xxxxxx, MD
xxxxxxx xxxxxx, MD
xxxx-xxxxx xxxx, MD, PhD, FACC
Copy link to clipboard
Copied
Obi-wan Kenobi
Your solution worked as well and I had not even considered approaching it this way. The only drawback to this method would be that there are about 30 pages and I would have to go through and select the Authors section on each page. But until I become a little more familiar with GREP, making a selection rather than attempting to fix an entire document will probably work just fine. Thanks for your input.
d.
Copy link to clipboard
Copied
Not at all!
You can use a simple grep style too! Nothing else to do! More … magical!
If you type "MD.", the period automatically disappears! Cool!
Copy link to clipboard
Copied
Yes, Obi-wan Kenobi,
it's more … magical. But the dot always exists in the document.
You don't need to play detective.
(?<=,\s\u)([\l\u]{1,3})\.(?=(,|$))
means:
(?<=,\s\u) find (but ignore the previous): comma and space and uppercase letter
([\l\u]{1,3}) find and save in $1: any letter one up to three times (this part will be replaced later)
\. find: the dot
(?=(,|$)) find (but ignore the following): comma (or) end of paragraph
Have fun
Copy link to clipboard
Copied
Your english is just fine and your GREP expression is SPOT ON. For some reason I had to run it through 4 times but it worked like a charm. I'm going to "reverse engineer" your expression so that I can figure out exactly how it works. Many, many thanks.
d.
Copy link to clipboard
Copied
Do you realize that "Phd" and "etc" (the OP asked for that) have lowercase characters? 😉
(MD|Phd|FAAC|etc)\.(?=[.,!?]| (Phd|\u{2}|\l))
Dirk
Find more inspiration, events, and resources on the new Adobe Community
Explore Now