Re: Converting SED expression to preg_match()
| From: | Danny | Date: | Sun, 13 Dec 2015 14:09:37 +0000 |
| Subject: | Re: Converting SED expression to preg_match() | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-325288@lists.php.net to get a copy of this message | ||
Thanks ... with a bit of hacking I can make it work ... ;) ...
Danny
On Dec 13 15, shiplu :
> To: Danny <mynixmail@gmail.com>
> Date: Sun, 13 Dec 2015 17:10:46 +0600
> From: shiplu <shiplu.net@gmail.com>
> Subject: Re: [PHP] Converting SED expression to preg_match()
>
> 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@gmail.com> 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