regular expression

I have a bunch of urls like
and I want to reduce them to end at the .com/
I don't want all the extra subdirectory information and page information like
to be there. So in the above example I just want

Can someone give me the regular expression for this? I am using notepad++ regular expression engine.

Who is Participating?
notjamesConnect With a Mentor Commented:
]$ perl -we '
use strict;

my $url = "";

$url =~ s/(?:^(http.*\.com)).*$/$1/;

print $url,"\n";



 $url =~ s/(?:^(http.*\.com)).*$/$1/;

 is the regex you're looking for.
ccwill88Connect With a Mentor Commented:
The regular expression to get first part of url:


Open in new window

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

amit_gConnect With a Mentor Commented:
Find what:


Open in new window

Replace with:


Open in new window

onyourmarkAuthor Commented:
This seems to find the entire string not just the ending

onyourmarkAuthor Commented:
Sorry, you are right. It works! Thanks.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.