Closed GoogleCodeExporter closed 8 years ago
That is how it's meant to work. AFTER and BEFORE put content on a new line
BEFORE/AFTER the match. What you need to use is replace. Note in the replace,
you would need to use
<add><![CDATA[something blue and]]></add>
Original comment by DJG6...@gmail.com
on 13 Apr 2012 at 5:40
Linux even haha
Original comment by blacka...@gmail.com
on 13 Apr 2012 at 5:42
Ok Thankyou. Feature request perhaps?
Original comment by blacka...@gmail.com
on 13 Apr 2012 at 5:46
I don't really see how that would be more beneficial? It will add more overhead
for a feature that already does it just fine
Original comment by DJG6...@gmail.com
on 13 Apr 2012 at 5:49
[deleted comment]
Lets say the line:
<div class="image"><a href="<?php echo $popup; ?>" title="<?php echo
$heading_title; ?>" class="colorbox" rel="colorbox"><img src="<?php echo
$thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo
$heading_title; ?>" id="image" /></a></div>
Maybe not the best example especially after writing... I want to say add an
additional class to the link element. I'm happy that $popup is going to be
always there, followed by anything (perhaps a theme added an alt or something,
or the class before the title). So the search is /\$popup.*?class="/i to match
the first class after popup. I then want to add additional classes with the
after function. I don't want to replace with new code in case I change
something with the theme.
Original comment by blacka...@gmail.com
on 13 Apr 2012 at 5:58
Of course, you could just simplify, use
<search regex="true"
position="after"><![CDATA[/(\$popup.*?class=")/i]]></search>
<add><![CDATA[$1newClass ]]></add>
Which would do the same thing, and not require adding the functionality
Original comment by DJG6...@gmail.com
on 13 Apr 2012 at 6:02
[deleted comment]
should be "replace" above not "after" in the position
Original comment by DJG6...@gmail.com
on 13 Apr 2012 at 6:06
That would just output
<div class="image"><a href="<?php echo $popup; ?>" title="<?php echo
$heading_title; ?>" class="colorbox" rel="colorbox"><img src="<?php echo
$thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo
$heading_title; ?>" id="image" /></a></div>
$lnewClass
Where it would be beneficial to have
<div class="image"><a href="<?php echo $popup; ?>" title="<?php echo
$heading_title; ?>" class="$lnewclass colorbox" rel="colorbox"><img src="<?php
echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo
$heading_title; ?>" id="image" /></a></div>
Original comment by blacka...@gmail.com
on 13 Apr 2012 at 6:06
sorry corrected a typo there and you had already replied.
Confused about how that would work, as I don't know what the vqmod regex found
in order to insert it back into the variable
Original comment by blacka...@gmail.com
on 13 Apr 2012 at 6:08
it will add back everything the regex matches, since the "replace" is identical
to the preg_replace function when position="replace" and regex="true"
Original comment by DJG6...@gmail.com
on 13 Apr 2012 at 6:09
Ah i'm being a muppet here and reading that as a L not 1, didn't even think it
would return anything in vqmod like preg_replace. Thanks for the time
Original comment by blacka...@gmail.com
on 13 Apr 2012 at 6:14
Original issue reported on code.google.com by
blacka...@gmail.com
on 13 Apr 2012 at 5:38