Re: Converting SED expression to preg_match()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Extracting with XPath is much easier. Why bother regex?

$doc = new DOMDocument();
$doc->loadHTMLFile("yourfile.html");
$xpath = new DOMXPath($doc);
$nodes = $xpath->query('//pre/span//text()');
foreach($nodes as $node){
    echo $node->nodeValue. "\n";
}

This prints

http://paste.ubuntu.com/13987562/


On Sun, Dec 13, 2015 at 3:41 PM, Danny <mynixmail@xxxxxxxxx> wrote:

> Hi guys,
>
> I am trying to convert the following SED line to do the same thing in
> preg_match() ...
>
> sed -netP -e's/<br>[[:alpha:]][0-9]\{3}[^<]*<br>/\n&\n/;D;:P' -eP\;D
>
> Any pointers would be appreciated ...
>
> more infor can be found here:
>
> unix.stackexchange.com/questions/247730/regular-expression-not-matching-all-possibilities
>
> Thank You
> Danny
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Shiplu.Mokadd.im
Unix Hacker

*Innovation distinguishes between follower and leader *
—  Steve Jobs


*An expert is a person who has made all the mistakes that can be made in a
very narrow field.*— Neils Bohr

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux