LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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, 09: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, 09:38 AM   #2
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 241Reputation: 241Reputation: 241
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, 09:39 AM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
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, 03:28 AM   #4
vonbiber
Member
 
Registered: Apr 2009
Distribution: slackware
Posts: 299

Rep: Reputation: 50
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 12:18 PM
Need help with Regular Expression subaruwrx Linux - Newbie 6 09-04-2004 08:48 PM
Anyone know regular expression? ahhua Linux - Software 1 12-04-2003 09:13 AM
Regular Expression slizadel Programming 4 07-28-2003 06:16 AM
regular expression gumby Programming 3 07-15-2003 01:13 PM


All times are GMT -5. The time now is 05:53 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration