tags:

views:

30

answers:

1

Hi,

Kindly help me know the regex to select only span id for a given span markup. I'm trying to do it from inside c#. My input is like . And I want as an output only >> id="x8x8d9s8" <<

Currently I'm trying to achieve above as follows but no luck, unfortunately ...

string innerPattern = @"(id=)\""|&quot;|(.)*\""|&quot;|";

Please note its only the start span tag, I do not want to include end span tag i.e.

Any help would be greatly appreciated.

Thanks in advance.

+2  A: 

What about this :

(id=".*?")

In C# :

@"(id="".*?"")"

Tried on this regex tester with tagada <span id="test" tagada />

Colin Hebert
Wow ! worked like a charm ! Thanks a lot. You saved me a really good amount of time. Thanks :)