Solved

Regular expression formula for searching in html

Posted on 2009-04-01
4
283 Views
Last Modified: 2013-11-26
Hi All,

I want to be able to find the title name in the following html tag.

Eg: It should find 'Easter'

level1_folder_id=2%2C534%2C374%2C302%2C037%2C960&FOLDER%3C%3Efolder_id=2534374302037960&bmUID=1238642661559">Easter</a></li><div><img alt=''  src='/website/media/images/leftNav/rowSpacer_v1_m56577569830626268.png'></div>      

Or it should find 'General Merchandise'

level1_folder_id=2%2C534%2C374%2C302%2C037%2C963&FOLDER%3C%3Efolder_id=2534374302037963&bmUID=1238642661559">General Merchandise</a></li><div><img alt=''  src='/website/media/images/leftNav/rowSpacer_v1_m56577569830626268.png'></div>

Thanks in advance for all your help, i am very stuck at the moment.

Feds
0
Comment
Question by:fedders_world
  • 2
  • 2
4 Comments
 
LVL 3

Expert Comment

by:gmrsecs
ID: 24046788
try the following one:

(?<=level1_folder_id=[^>]*>)((?=[^<>]*</a>)[^<>]*)

Open in new window

0
 

Author Comment

by:fedders_world
ID: 24055507
Thanks gmrsecs!

That worked wonders, but could i ask an additional question.

"<META NAME="DCSext.DD_LEVEL_2" CONTENT="Dairy">"

or <META NAME="DCSext.DD_LEVEL_2" CONTENT="Milk & Bread">

What regular expression would get the "Dairy" and Milk & Bread"


Thanks for your help :)

Aaron
0
 
LVL 3

Accepted Solution

by:
gmrsecs earned 500 total points
ID: 24056955
usually you should create another question.
but I give you the solution!

1) if you are interested in getting the CONTENT attribute value for any  META element, then:
(?<=<META[^>]*CONTENT=")((?=[^>"]*">)[^<>"]*)
2) else, if the name has a significance, then :
(?<=<META[^>]*NAME="DCSext.DD_LEVEL_2"[^>]*CONTENT=")((?=[^>"]*">)[^<>"]*)  
0
 

Author Closing Comment

by:fedders_world
ID: 31565635
Thanks so very much gmrsecs:)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now