xploit Posted June 10, 2009 at 04:18 AM Report #271215 Posted June 10, 2009 at 04:18 AM Viva, estou a tentar obter o código contido entre duas tags: php preg_match_all('<!--beginMenu-->(.*?)<!--endMenu-->',$HTML,$output); html <!--beginMenu--> Olá eu sou o código que devia aparecer no $output. <!--endMenu--> O que está mal no preg match? tks
mesquitan Posted June 10, 2009 at 08:54 AM Report #271218 Posted June 10, 2009 at 08:54 AM Boas, Penso que tenha a ver com a mudança de linhas, esperimenta isto: <!--beginMenu-->\n*?(.*?)\n*?<!--endMenu--> Cumprimentos, mesquitan
xploit Posted June 10, 2009 at 01:24 PM Author Report #271251 Posted June 10, 2009 at 01:24 PM Não funcionou 😞.. não consigo perceber o que está errado aparece o array do preg match em branco.
bruno1234 Posted June 10, 2009 at 01:28 PM Report #271252 Posted June 10, 2009 at 01:28 PM Experimenta por o ? depois dos (), assim: <!--beginMenu-->(.*)?<!--endMenu--> Matraquilhos para Android. Gratuito na Play Store. https://play.google.com/store/apps/details?id=pt.bca.matraquilhos
xploit Posted June 10, 2009 at 01:45 PM Author Report #271253 Posted June 10, 2009 at 01:45 PM preg_match_all("<!--beginMenu-->(.*)?<!--endMenu-->",$this->HTML,$output); print_r($output); aparece em branco.. 😞
Guest id194 Posted June 10, 2009 at 03:15 PM Report #271268 Posted June 10, 2009 at 03:15 PM preg_match_all('#<!--beginMenu-->(.*)<!--endMenu-->#s', $HTML, $output); Se a ideia for apanhar conteúdo entre múltiplas tags, isto não funciona. Se for só uma, já funciona.
The Loser Posted June 10, 2009 at 03:22 PM Report #271270 Posted June 10, 2009 at 03:22 PM Para além de não colocares nenhum delimiter na tua expressão, esqueceste-te do s depois do closing delimiter para indicar o "suporte" a newlines. 😞 EDIT: Como o Nazgulled mostrou. ^^ I intend to live forever. So far so good.
xploit Posted June 10, 2009 at 03:46 PM Author Report #271277 Posted June 10, 2009 at 03:46 PM Funcionou perfeitamente obrigado Nazgulled 😞
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now