[Linux-disciples] Negative lookahead assertion

Adam Rosi-Kessel adam at rosi-kessel.org
Fri Jul 22 15:51:59 EDT 2005


Well, this works:

joehill:~>cat a
xxx
xyyx
xzx
joehill:~>cat a|perl -pe 's/^x(?!yy)/xy/g'
xyxx
xyyx
xyzx

But you didn't close the bracket on your blockquote below. Is that the issue?  


On Fri, Jul 22, 2005 at 01:26:20PM -0400, Stephen R Laniel wrote:
> I want to find every find within my blog that contains a
> <blockquote> without a <p> immediately after, and replace it
> with <blockquote><p>. So (with some edge cases taken out for
> simplicity) I thought I should be able to use this Perl
> command:
> 
> s{<blockquote(?!<p>)}{<blockquote><p>}g
> 
> using the 'negative lookahead' operator that Adam and Ken
> have mentioned on here before. But it's not working. Instead
> it seems to be *erasing* everything after the <blockquote>.
> Should I be doing something differently here?
> 

> -- 
> Stephen R. Laniel
> steve at laniels.org
> +(617) 308-5571
> http://laniels.org/
> PGP key: http://laniels.org/slaniel.key



> _______________________________________________
> Linux-disciples mailing list
> Linux-disciples at lists.bostoncoop.net
> http://lists.bostoncoop.net/mailman/listinfo/linux-disciples


-- 
Adam Rosi-Kessel
http://adam.rosi-kessel.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.bostoncoop.net/pipermail/linux-disciples/attachments/20050722/7a8a28fb/attachment.pgp


More information about the Linux-disciples mailing list