Regular Expression to find the first occurence of a word in

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
nvedia
Posts: 4
Joined: Fri Oct 17, 2008 6:32 pm

Regular Expression to find the first occurence of a word in

Post by nvedia »

Lets say I have this string

firstpartfhttp://domainabc.comhttp://domainxyz.comand this goes on

I need to find the first full domain in this starting with http:// and ending in com
When I search for http://.*.[com] in TextPad, I get the result as

http://domainabc.comhttp://domainxyz.com
But I want the result to be
http://domainabc.com

http://([a-z]([a-z0-9-]*[a-z0-9])?\.(com|net|org)) seems to work in Perl but not in TextPad
Please help
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Use Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
Doesn't
http://[^:]+\.(com|net|org)
do what you want more simply?
Post Reply