Skip to main content
BEGINNER_X
Legend
June 26, 2014
Answered

Find URL Using GREP

  • June 26, 2014
  • 1 reply
  • 1205 views

Hi All,

Request:

I need to find URL end with '.com', '.org', '.uk' etc by using GREP.

i.e.,

abcde@duval.com

zeoue@rediff.uk

rajjjesz.sir555@gmail.corp.fr

(zzzz@yahoo.com)


Please help for the above request ASAP.


-----------------------------------------------------------------------------------

But, I got the solution for the content start with 'http' or 'www'

Using Forum Grep Code is: (?i)(http|www)\S+[\l\u|\d]

Regards

Siraj



This topic has been closed for replies.
Correct answer Chinnadk

Hi All,

Trying GREP code:

\s+.+\.ca

\s -- space

.+ --- one or more character

\.ca --- end with .ca character

And also try zero or one time(short match)

But I cannot find the solution. Very urgent request. Please help.

Please refer the attachment for more clarifications.


Hi Siraj,

Check now.

var doc = app.activeDocument; 

app.findGrepPreferences  = app.changeGrepPreferences = null; 

app.findGrepPreferences.findWhat = "[a-z0-9!#$%&'*+/=?^_`{|}­]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}­]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?"; 

var found = doc.findGrep();

for(var i=0;i<found.length;i++)

{

        alert(found.contents)

    }

Regards,

Chinna

1 reply

Chinnadk
Legend
June 26, 2014
BEGINNER_X
Legend
June 26, 2014

Hi Chinna,

Thank you for your immediate reply...

By using, you mentioned link, I can't able to find the exact solution for my request.

It miss few occurrences.

Is it possible to find URL end with '.com', '.org', '.uk' etc by using GREP.

similar like this

(?i)(http|www)\S+[\l\u|\d]


Thanks in advance

Siraj

BEGINNER_X
Legend
June 26, 2014

Hi All,

Trying GREP code:

\s+.+\.ca

\s -- space

.+ --- one or more character

\.ca --- end with .ca character

And also try zero or one time(short match)

But I cannot find the solution. Very urgent request. Please help.

Please refer the attachment for more clarifications.