RegEx Hilfe

  • VB.NET

Es gibt 2 Antworten in diesem Thema. Der letzte Beitrag () ist von Link.

    RegEx Hilfe

    Hallo Zusammen,

    ich benötige eure Unterstützung bei RegEx.

    Ich habe folgenden SoruceCode:

    HTML-Quellcode

    1. <tbody> <tr><td class="icon"><img class="itemCategory itemCategory_bandage33" src="img/x.gif" title="Bandage||Reincarnate your troops. The amount of troops that will be reincarnated is 2 times of bandages amount in your heros bag. Your hero must survive the battle to use this item."></td><td class="name">25050 x Bandage</td><td class="bids">1</td><td class="silver" title="0 For each unit">31</td><td class="time"><span id="timer1">00:11:20</span></td><td class="bid"><a class="bidButton openedClosedSwitch switchClosed" href="?action=buy&filter=8&a=35337">Change</a></td></tr><tr><td class="icon"><img class="itemCategory itemCategory_bandage33" src="img/x.gif" title="Bandage||Reincarnate your troops. The amount of troops that will be reincarnated is 2 times of bandages amount in your heros bag. Your hero must survive the battle to use this item."></td><td class="name">26720 x Bandage</td><td class="bids">1</td><td class="silver" title="0 For each unit">33</td><td class="time"><span id="timer2">00:11:20</span></td><td class="bid"><a class="bidButton openedClosedSwitch switchClosed" href="?action=buy&filter=8&a=35352">Change</a></td></tr><tr><td class="icon"><img class="itemCategory itemCategory_bandage33" src="img/x.gif" title="Bandage||Reincarnate your troops. The amount of troops that will be reincarnated is 2 times of bandages amount in your heros bag. Your hero must survive the battle to use this item."></td><td class="name">19205 x Bandage</td><td class="bids">1</td><td class="silver" title="0 For each unit">24</td><td class="time"><span id="timer3">00:11:20</span></td><td class="bid"><a class="bidButton openedClosedSwitch switchClosed" href="?action=buy&filter=8&a=35354">Change</a></td></tr><tr><td class="icon"><img class="itemCategory itemCategory_bandage33" src="img/x.gif" title="Bandage||Reincarnate your troops. The amount of troops that will be reincarnated is 2 times of bandages amount in your heros bag. Your hero must survive the battle to use this item."></td><td class="name">16700 x Bandage</td><td class="bids">1</td><td class="silver" title="0 For each unit">21</td><td class="time"><span id="timer4">00:11:20</span></td><td class="bid"><a class="bidButton openedClosedSwitch switchClosed" href="?action=buy&filter=8&a=35364">Change</a></td></tr><tr><td class="icon"><img class="itemCategory itemCategory_bandage33" src="img/x.gif" title="Bandage||Reincarnate your troops. The amount of troops that will be reincarnated is 2 times of bandages amount in your heros bag. Your hero must survive the battle to use this item."></td><td class="name">19205 x Bandage</td><td class="bids">1</td><td class="silver" title="0 For each unit">24</td><td class="time"><span id="timer5">00:11:20</span></td><td class="bid"><a class="bidButton openedClosedSwitch switchClosed" href="?action=buy&filter=8&a=35366">Change</a></td></tr> </tbody>



    Und benötige als erstes die Zahl 35337 und die Zahlen die hinter den weiteren Code nach

    HTML-Quellcode

    1. href="?action=buy&filter=8&a=
    stehen also in dem Fall: 35352, 35354, 35364, 35366.

    Für eure Hilfe bin ich euch dankbar :)

    Liebe Grüße
    RegEx Tutorial - Blutige Anfänger und Fortgeschrittene

    Spoiler anzeigen

    VB.NET-Quellcode

    1. Dim pattern As String = "href=""\?action=buy&filter=8&a=(\d{1,})"
    2. Dim options As RegexOptions = RegexOptions.Multiline
    3. For Each m As Match In Regex.Matches(input, pattern, options)
    4. Console.WriteLine("'{0}' found at index {1}.", m.Groups(1).Value, m.Index)
    5. Next