I have a question about regex

Asked

Viewed 69 times

0

Well, how do I make pro regex identify that I am wanting to catch the first closing of a tag IE, wanted to catch clinging to the first line of the tag li and soon after wanted to do a foreach to go capturing line by line.

But I don’t know how to do it...

Here’s an example of regex in practice: https://regex101.com/r/sM9jW0/1

  • Want to pick up pieces of HTML? Can you show the HTML you have and the piece you want to select? have you looked at http://php.net/manual/en/class.domdocument.php ?

  • Haha is you Sergio? Poxa thought you were Brazilian rsrs, thanks for answering... Yes I want to pick up pieces of HTML, follow the link so you can see what I’m trying to do: https://regex101.com/r/sM9jW0/1

  • I had seen this link from regex101, can you give an example of the result you want to have? In other words, the lines you expect to be at the end.

  • I will explain better, is the following I am on this site: http://www.filmesonlinegratis.net/assistir-a-era-do-gelo-big-bang-dublado-online.html I am trying to get the movie players... in case I want to get like the player 1 -> iframe 1, player 2 -> iframe 2 and so on, thus putting them in a foreach to display the amount of players that the site has

  • 1

    Getting HTML by REGEX is not a good thing. PHP provides a specific resource for this, the DOMDocument, see http://www.php.net/manualen/book.dom.php. If you understand the Javascript DOM it is extremely easy to use this, basically risk saying it is "same thing" haha. :)

  • Follow the code I am currently using: http://pastebin.com/0nVqxRTp

  • @Inkeliz I even started using Domdocument, but I was not successful, actually I’m having difficulties understanding the DOM process

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.