How do I use regex to get a string from a HTML tag

0 favourites
  • 3 posts
  • Hi. I searched for some regex examples and after reading a while my head was about to explode.

    I want to get a string from a html page which is inside a specific tag (but the tag exists multiple times).

    I will need to take some time to dig into it but is there anyone experienced with regex who could help me with this little problem?

    I have html like this:

    [quote:258bnbi6]MORE HTML ABOVE


    <li><a href="//">Weekly Brawl: SHOW YOUR SUPPORT</a></li>

    <li><a href="//">[PC] Patch Notes</a></li>




    and the regex should get the text behind "Weekly Brawl: " so I can read the weekly changing brawl from the website to show it in the app. The text is different each week (shorter/longer).

    the href (link) changes everytime too and should be ignored, just the text behind weekly brawl is important.

    Just getting all "li" tags would have too many results so it should just find the line with weekly brawl with a <li> at the start.

    I will try to read more tutorials about it but any help would be very appreciated.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you very much!

    Next step is to get the achievement data.

    It may work with a separate regex action for each achievement but one which gets all of them at once would be much faster/better.

    Any hints or a link to good/easy tutorial for regex would be great.

    The unfinished achievements have the div class "m-disabled" and I need to get all achievements (all lines with "data-tooltip="achievement-"?) and then get the achievement id (data-tooltip) and if it has "m-disabled" as class or not. This should be possible with regex, right?

    Here are 2 examples from the code:

    <div class="column xs-6 sm-6 md-4 lg-3 xl-2"><div class="media-card m-hoverable m-clickable u-margin-bottom-md" data-tooltip="achievement-0x0E60000000000192"><div class="container"><img class="media" src=""><div class="content">The Friend Zone</div></div></div><div class="tooltip-media-card" id="achievement-0x0E60000000000192"><span class="arrow"></span><h6 class="h5">The Friend Zone</h6><p class="h6">Play a Quick or Competitive Play game in a group with a friend.</p></div></div>
    <div class="column xs-6 sm-6 md-4 lg-3 xl-2"><div class="media-card m-disabled m-clickable u-margin-bottom-md" data-tooltip="achievement-0x0E6000000000015E"><div class="container"><img class="media" src=""><div class="content">The Path Is Closed</div></div></div><div class="tooltip-media-card" id="achievement-0x0E6000000000015E"><span class="arrow"></span><h6 class="h5">The Path Is Closed</h6><p class="h6">Destroy 3 of Symmetra's Teleporters in a single Quick or Competitive Play game.</p></div></div>[/code:3t6jc4j4]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)