LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-08-2009, 08:32 AM   #1
0.o
Member
 
Registered: May 2004
Location: Raleigh, NC
Distribution: Debian, Solaris, HP-UX, AIX
Posts: 208

Rep: Reputation: 35
Regular Expression


I am trying to build a regular expression that will match the following:

http://www.linkedin.com/[a-zA-Z0-9]+
(the above URL followed by anything on the site)

Could someone point me in the right direction?

Thanks!
 
Old 06-08-2009, 08:38 AM   #2
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
show an actual example of the input file you are parsing. basically, there is no need for a regular expression. the general logic can be:
Code:
if "http://" in string
 
Old 06-08-2009, 08:39 AM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
What utility are you using? Depending on the context, you may already have it....

You can also use:
http://www.linkedin.com/.*
 
Old 06-09-2009, 02:28 AM   #4
vonbiber
Member
 
Registered: Apr 2009
Distribution: slackware 14.1 64-bit, slackware 14.2 64-bit, SystemRescueCD
Posts: 533

Rep: Reputation: 129Reputation: 129
Quote:
Originally Posted by 0.o View Post
I am trying to build a regular expression that will match the following:

http://www.linkedin.com/[a-zA-Z0-9]+
(the above URL followed by anything on the site)

Could someone point me in the right direction?

Thanks!
you want to get what's after 'http://www.linkedin.com/'?
if you're parsing an html file and you want
to retrieve this info from the hyperlinks found in file.html

sed 's?href=[^ >]*?\n&\n?g' file.html | grep -i 'href=' | \
grep 'http://www\.linkedin\.com' | \
sed 's?^.*http://www\.linkedin\.com/\([^'" \t>]*\).*$?\1?' | \
sort -u

does that answer your question?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with regular expression Feyd-Rautha Programming 8 04-21-2008 11:18 AM
Need help with Regular Expression subaruwrx Linux - Newbie 6 09-04-2004 07:48 PM
Anyone know regular expression? ahhua Linux - Software 1 12-04-2003 08:13 AM
Regular Expression slizadel Programming 4 07-28-2003 05:16 AM
regular expression gumby Programming 3 07-15-2003 12:13 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration