Solved

Regular expression formula for searching in html

Posted on 2009-04-01
4
281 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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…

757 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

18 Experts available now in Live!

Get 1:1 Help Now