• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

grep only mail

Participant ,
Sep 02, 2020 Sep 02, 2020

Copy link to clipboard

Copied

how could I delete a text all but not the emails?
this find the mail...
\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b

but I mean finds everything but not this and erases

TOPICS
How to , Scripting

Views

1.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Sep 02, 2020 Sep 02, 2020

I like simplicity when I use Grep! …

 

Create a "condition" you call "email"!

 

1/ 

Find:  \b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b

Replace by: $0\r   +   "condition email"

 

[your Grep code, not verified - let's say it's cool!  ðŸ˜‰  ]

 

2/

Find: (?s).+   +   "no condition"

Replace by: nothing

 

Now your have your emails list!

 

(Remove the "condition email" in your "Conditions" panel)

 

(^/)  The Jedi

Votes

Translate

Translate
Community Expert ,
Sep 02, 2020 Sep 02, 2020

Copy link to clipboard

Copied

Try the following

 

findWhat (?s).*(\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b).*
changeTo $1

 

-Manan

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 02, 2020 Sep 02, 2020

Copy link to clipboard

Copied

Your expressions delete the email addresses, Manan, don't they?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 02, 2020 Sep 02, 2020

Copy link to clipboard

Copied

Ahh, apologies for doing the opposite of what was asked. I edited the reply with my take on the issue. Thanks, Peter for catching this one

-Manan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 02, 2020 Sep 02, 2020

Copy link to clipboard

Copied

this works with one email, but I have a lot of them in a text and I wanted to get a list

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 07, 2020 Sep 07, 2020

Copy link to clipboard

Copied

That produces a single long string of uninterrupted email addresses. You should probably change the replacement string to

$1\r

P. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 07, 2020 Sep 07, 2020

Copy link to clipboard

Copied

Hi Peter,

 

The post-posting correction (by Manan) is still annoying and unacceptable in my opinion. This makes following comments posted after the "wrong" answer and before the patch truly unreadable!
That's said, with or without "\ r" (your comment above), Manan's Grep code is still wrong (and can't be marked as "correct answer")!

 

Tested on:

 

tintin.fridnge@gmail.com nos aceptatum di beaquatur, none alit minciliquo totate vita num qui ad exeri reic te molor. ut incimagnihit rem in noneturiatur aut ides apis audigendaest fuga. Nam, auta milou.fridnge@gmail.com consed utem inis sequodi perovid endit, omnimus aut ilitassi test a perum utempor aut odit lique elique nonsed quibuste non-peritetus aut volor volorerum dolentionse conem quasi ut et faceser iberunilia nus expeliq uidenis dolore pores rat remos eum, ipid etomnivurucerts nemolup tatiusa volor sitate pere doloreped quo magnis quae dupont.fridnge@gmail.com.

dupond.fridnge@gmail.com rem in noneturiatur aut ides apis audigendaest fuga. Nam, auta sequi dolut ut que magni volore por seque palorro endit, omnimus aut tournesol.fridnge@gmail.com aut ex etus nsequas sitatur rerorer cidelenis ut aut volorerum dolentionse conem quasi blaut ipid etomnivurucerts ne blaborro inusam, tet magnatum haddock.fridnge@gmail.com aut oditi di officimus il maio. Aspellor simus, velit enis re vent et undus ium-quis esero int exerum facerum debitatio cusdae venimporenis adit estium elia imin et eos dolup tur?

 

(^/)  The Jedi

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 07, 2020 Sep 07, 2020

Copy link to clipboard

Copied

Michel -- You are correct that Manan's reply is not correct, and I hadn't even noticed the problem you point out now.

That said, you're hardly the best-placed person to call someone's answer annoying and unacceptable.

P.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 07, 2020 Sep 07, 2020

Copy link to clipboard

Copied

Peter,

 

Read me more carefully: I've never written Manan's answer is "annoying and unacceptable"! I only talk about the fact to correct an answer after others have commented it!

 

Btw, even if my way is simple and relevant, there's another one you should have mentioned and I let you comment it! It's about "Grep Query Manager" script you wrote 10 years ago and the feature it includes to create the wanted list of emails directly found by Stefanofe's original Grep code!  ðŸ˜‰

 

https://creativepro.com/files/kahrel/indesign/grep_query_manager.html

 

Some days ago, Marc Autret posted a third (interesting) way ["DocGrepTextFindAll.jsx" script]:

 

https://github.com/indiscripts/IdGoodies/blob/master/snip/DocGrepTextFindAll.jsx

 

(^/)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 08, 2020 Sep 08, 2020

Copy link to clipboard

Copied

Hi Michel,

So I don't think anything on my part was "annoying and unacceptable", as first I did not shy away from accepting that I made a mistake, and second I also properly mentioned that I am editing the answer. This is not a race in my opinion, that someone's answer is going to eclipse the others. My answer was wrong the first time and did not handle all the cases the next time, I got pointed for that by Peter and yourself. Your answer correctly handled the OP's need, that was acknowledged by the OP and Peter, what else is needed? No one can control the behaviour of someone marking/unmarking the answers correct, and I for sure did not mark my answer correct if you implied that, I have no liking for that to be really clear.

P.S. :- Editing incomplete/wrong answers is something that lots of folks do out here even veterans. The reason I do it is to keep the discussion thread clean and prevent the users from jumping from one comment to another.

-Manan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 08, 2020 Sep 08, 2020

Copy link to clipboard

Copied

Grep is a complex matter lots don't understand clearly!

 

So keep answers that are not relevant seems to me more interesting because posters can explain why they are not correct and allows discussion about such a point.

 

But it's a personal point of view!  ðŸ˜‰

 

I remember a topic some years ago where I did the same thing as you! ACPs were very angry about that and they didn't hesitate to openly say it to me! …

I thought first they were because it was me! [ =D ] … but then I realised they were totally right! With the nesting of responses without temporal logic in the Adobe new forums, it is even more true!

 

I just continue to correct posts ONLY IF there's no other answer written after them!

 

(^/)  ðŸ˜‰

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 08, 2020 Sep 08, 2020

Copy link to clipboard

Copied

LATEST

Ok, that's funny I see ACP's doing the same all the time. Anyhow, I do understand what you are trying to say and can relate to it. I will try and keep a balance of both approaches.

I would encourage you to write more often though, that way of all the things we will have more discussions on different threads and would know better how each one of us engages with folks around here. See you around 🙂

-Manan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 02, 2020 Sep 02, 2020

Copy link to clipboard

Copied

I like simplicity when I use Grep! …

 

Create a "condition" you call "email"!

 

1/ 

Find:  \b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b

Replace by: $0\r   +   "condition email"

 

[your Grep code, not verified - let's say it's cool!  ðŸ˜‰  ]

 

2/

Find: (?s).+   +   "no condition"

Replace by: nothing

 

Now your have your emails list!

 

(Remove the "condition email" in your "Conditions" panel)

 

(^/)  The Jedi

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 02, 2020 Sep 02, 2020

Copy link to clipboard

Copied

How do I create a condition?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 03, 2020 Sep 03, 2020

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 03, 2020 Sep 03, 2020

Copy link to clipboard

Copied

Super! Thanks!

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines