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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 2
Title Test Details Extract "src" attr from EMBED tag (for Flash)
Expression
(?<=<embed\s[^<>]*?src\s*?=\s*?\x22)[^<>]*?(?=\x22[^<>]*?>)
Description
This pattern will extract the "src" attribute of an EMBED tag. 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.
Matches
In &lt;embed src="somefilename.swf" width="550" height="400"&gt; matches "somefilename.swf"
Non-Matches
Doesn't match the surrounding HTML.
Author Rating: Not yet rated. Tim Denby
Title Test Details 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
   Displaying page 1 of 1 pages; Items 1 to 2

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