RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Extract movie "value" attr from PARAM tag (for Flash)
Expression
(?<=<param(?=[^<>]*?name\s*=\s*\x22movie\x22)[^<>]*?value\s*=\s*\x22)[^<>]*?(?=\x22[^<>]*?>)
Description
This pattern will extract the "value" attribute of a PARAM tag where name="movie". I created it for extracting the URI of an Adobe Flash animation from some HTML, but of course it would work for more general purposes. Don't forget to turn on case insensitivity. Code tidied up with help from Sergei Z. in the forums. Here's an older version, without the nested lookarounds: (?<=<param\s[^>]*?name\s*?=\s*?\x22\s*?movie\s*?\x22[^>]*?value\s*?=\s*?\x22)[^>]*?(?=\x22[^>]*?>)|(?<=<param\s[^>]*?value\s*?=\s*?\x22)[^>]*?(?=\x22[^>]*?name\s*?=\s*?\x22\s*?movie\s*?\x22[^>]*?>)
Matches
In &lt;param name="movie" value="somefilename.swf"&gt; matches "somefilename.swf"
Non-Matches
Doesn't match the surrounding HTML, Doesn't match non-"movie" params, e.g. &lt;param name="song" value="somefilename.mp3"&gt;
Author Rating: Not yet rated. Tim Denby
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Copyright © 2001-2025, RegexAdvice.com | ASP.NET Tutorials