2015-11-04 35 views
0

我:正則表達式選擇所有的C#

<div class="content-text view-item-long-description-content"> 
     Yellow Taxi Magnetic Base Roof Top Cab LED Logga ljus med cigarett&#228;ndare 12V<br /> 
<br /> 
Helt ny!!!<br /> 
Material: H&#246;g kvalitet PVC<br /> 
Magnetisk bas (Easy f&#228;sta p&#229; taket)<br /> 
F&#228;rg: Gul (Vitt &#228;r ocks&#229; tillg&#228;ngliga.)<br /> 
LED-ljus F&#228;rg: Gul<br /> 
Antal: 1 st<br /> 

</div> 

我想選擇view-item-long-description-content"></div>之間的一切。

我嘗試:

Regex Allb = new Regex(@"content-text\s*view-item-long-description-content"">(.+?)</div>"); 

如何我可以選擇一切嗎?

回答

0

如何:

Match match = Regex.Match(input, "view-item-long-description-content\">(?'content'.*)<\\/div>"); 
if (match.Success) 
{ 
    string content = match.Groups["content"].Value; 
    // content is the whole block inside those two strings 
} 
else 
{ 
    // There was no match 
}