By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,041 Members | 1,018 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,041 IT Pros & Developers. It's quick & easy.

Regex problem - please help.

P: n/a
My problem is simple, but I spent lot of time playing with regex and I am
going nuts.

I need to automatically (many times per day) extract HEADING and
DESCRIPTION from the html code below?
HTML CODE:

<a href="http://www.mylink.com">HEADING</a><br>DESCRIPTION<br>
I am able to get the link already using this regex command:
"a.*href\s*=\s*(?:""(?<1>[^""]*)""|(?<1>\S+))"

Can someone write REGEX command to get HEADING and DESCRIPTION.
Please, it would be really appreciated.

K.
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi,

Check out regexlib.org. Has a ability to search for regex and link
to the regulator a regex tester.

http://www.regexlib.com/Default.aspx
http://www.regexlib.com/Search.aspx?k=html
Ken
---------------------
"Krakatioison" <Kr**********@huh.com> wrote in message
news:41**********@Usenet.com...
My problem is simple, but I spent lot of time playing with regex and I am
going nuts.

I need to automatically (many times per day) extract HEADING and
DESCRIPTION from the html code below?
HTML CODE:

<a href="http://www.mylink.com">HEADING</a><br>DESCRIPTION<br>
I am able to get the link already using this regex command:
"a.*href\s*=\s*(?:""(?<1>[^""]*)""|(?<1>\S+))"

Can someone write REGEX command to get HEADING and DESCRIPTION.
Please, it would be really appreciated.

K.

Nov 20 '05 #2

P: n/a
This I already went to... hm..
I guess there is no one who can fix me with the code, just by looking at it.
K.
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:u7**************@TK2MSFTNGP09.phx.gbl...
Hi,

Check out regexlib.org. Has a ability to search for regex and link to the regulator a regex tester.

http://www.regexlib.com/Default.aspx
http://www.regexlib.com/Search.aspx?k=html
Ken
---------------------
"Krakatioison" <Kr**********@huh.com> wrote in message
news:41**********@Usenet.com...
My problem is simple, but I spent lot of time playing with regex and I am
going nuts.

I need to automatically (many times per day) extract HEADING and
DESCRIPTION from the html code below?
HTML CODE:

<a href="http://www.mylink.com">HEADING</a><br>DESCRIPTION<br>
I am able to get the link already using this regex command:
"a.*href\s*=\s*(?:""(?<1>[^""]*)""|(?<1>\S+))"

Can someone write REGEX command to get HEADING and DESCRIPTION.
Please, it would be really appreciated.

K.

Nov 20 '05 #3

P: n/a
Krakatioison,
This one should work, I tested it against the sample you provided. You
may want to include the ignore case option. Let me know how that works out
for you.
Jared

(?:<a\s+href=[\"\'](?<Link>.+?)[\"\'>]+(?<Heading>(\w+))</a>(<(\w+)>)(?<Description>.*)\2)

"Krakatioison" <Kr**********@huh.com> wrote in message
news:41**********@Usenet.com...
This I already went to... hm..
I guess there is no one who can fix me with the code, just by looking at
it.
K.
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:u7**************@TK2MSFTNGP09.phx.gbl...
Hi,

Check out regexlib.org. Has a ability to search for regex and

link
to the regulator a regex tester.

http://www.regexlib.com/Default.aspx
http://www.regexlib.com/Search.aspx?k=html
Ken
---------------------
"Krakatioison" <Kr**********@huh.com> wrote in message
news:41**********@Usenet.com...
My problem is simple, but I spent lot of time playing with regex and I am
going nuts.

I need to automatically (many times per day) extract HEADING and
DESCRIPTION from the html code below?
HTML CODE:

<a href="http://www.mylink.com">HEADING</a><br>DESCRIPTION<br>
I am able to get the link already using this regex command:
"a.*href\s*=\s*(?:""(?<1>[^""]*)""|(?<1>\S+))"

Can someone write REGEX command to get HEADING and DESCRIPTION.
Please, it would be really appreciated.

K.


Nov 20 '05 #4

P: n/a
Jared,
thanks a lot for the time you spent with this.
I'll test it and get back to you
k.


"Jared" <VB***********@email.com> wrote in message
news:10*************@corp.supernews.com...
Krakatioison,
This one should work, I tested it against the sample you provided. You
may want to include the ignore case option. Let me know how that works out
for you.
Jared

(?:<a\s+href=[\"\'](?<Link>.+?)[\"\'>]+(?<Heading>(\w+))</a>(<(\w+)>)(?<Desc
ription>.*)\2)
"Krakatioison" <Kr**********@huh.com> wrote in message
news:41**********@Usenet.com...
This I already went to... hm..
I guess there is no one who can fix me with the code, just by looking at
it.
K.
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:u7**************@TK2MSFTNGP09.phx.gbl...
Hi,

Check out regexlib.org. Has a ability to search for regex and

link
to the regulator a regex tester.

http://www.regexlib.com/Default.aspx
http://www.regexlib.com/Search.aspx?k=html
Ken
---------------------
"Krakatioison" <Kr**********@huh.com> wrote in message
news:41**********@Usenet.com...
My problem is simple, but I spent lot of time playing with regex and I am going nuts.

I need to automatically (many times per day) extract HEADING and
DESCRIPTION from the html code below?
HTML CODE:

<a href="http://www.mylink.com">HEADING</a><br>DESCRIPTION<br>
I am able to get the link already using this regex command:
"a.*href\s*=\s*(?:""(?<1>[^""]*)""|(?<1>\S+))"

Can someone write REGEX command to get HEADING and DESCRIPTION.
Please, it would be really appreciated.

K.



Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.