duy.ly
duy.ly

Reputation: 323

C# RegularExpressions Match

I'm noob in C#. Can anyone help to pull out /a/b/c.swf from this data by C# code

<object width="663" height="466.752" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
      <param value="/a/b/c.swf" name="movie">
</object>

thank so much

Upvotes: 1

Views: 212

Answers (2)

viggity
viggity

Reputation: 15227

string regexPattern = @"<param\svalue=""(?<paramVal>[^""]*)""";
string stuffImLookingFor = Regex.Match(input, regexPattern).Groups("paramVal").Value;

Upvotes: 4

mservidio
mservidio

Reputation: 13057

Here's a RegEx to do it:

param value="([^"]+)

The first match group will return "/a/b/c.swf"

You can test regular expressions here Regular Expression Library

Upvotes: 0

Related Questions