Solved

Regular expression formula for searching in html

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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…

623 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