1

テキスト内の「マッチャー」CSS スタイルに問題があります。次のスタイルを取得したい:

スタイル検索

<a id="d325" style="color: #ffffff;"> Visio Infrastructure and Applications </ a>

使用される正規表現:

Regex myRegex = new Regex(@"<a id=""d(.+?)"" style=""(.+)"" ><\/a>");

問題があると思いますが、style = "color: # fffff"理解できません。

どうもありがとう

4

2 に答える 2

3

あなたの正規表現の問題は

Regex myRegex = new Regex(@"<a id=""d(.+?)"" style=""(.+)"" ><\/a>");
                                                           ^         no space in the string
                                                             ^       the text between the tags is not matched
                                                                ^    there is a space in the string   

もう 1 つの質問は、正規表現がこの仕事に適したツールであるかということです。

于 2013-01-18T09:20:37.983 に答える
0

私の側からすると、これで正規表現の空白を忘れるだけです

<a\sid="d(.+?)"\sstyle="(.+)">.*?</a>

あなたは結果を持っています: 325色: #ffffff ;

あなたが望む結果ですか?

于 2013-01-18T09:25:33.160 に答える