Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Regular expression formula for searching in html

Posted on 2009-04-01
4
Medium Priority
?
289 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…

722 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