Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Regular expression formula for searching in html

Posted on 2009-04-01
4
Medium Priority
?
290 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 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

Whatever be the reason, if you are working on web development side,  you will need day-today validation codes like email validation, date validation , IP address validation, phone validation on any of the edit page or say at the time of registration…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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…

772 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