Help with Surrounding Links

General questions about using WildEdit

Moderators: AmigoJack, helios, bbadmin, Bob Hansen, MudGuard

Post Reply
Jam
Posts: 4
Joined: Sun Jun 29, 2008 10:47 pm

Help with Surrounding Links

Post by Jam »

Hi,

I have files that look something like this :

Code: Select all

<a href="http://www.example.com">example</a>

<a href="http://www.example.com">example</a>
And they need to be changed to this :

Code: Select all

$advarray[] = '<a href="http://www.example.com">example</a>';

$advarray[] = '<a href="http://www.example.com">example</a>';
So it's just a matter of appending and prepending everything between <a and /a>

In all cases there is only one link on each line, in case that matters.

I've tried following lots of examples from the documentation and the forum, but I must be missing something because every time I use \1 or $0 or $1 in the replace text, it results in actually printing \1 or $0 or $1 instead of the original text...

Thanks,
Jam
ben_josephs
Posts: 2457
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Select Replacement format:
Find what: <a .*?</a>
Replace with: $advarray[] = '$0';

[X] Regular expression
[X] Replacement format
Jam
Posts: 4
Joined: Sun Jun 29, 2008 10:47 pm

Post by Jam »

Wow, that was an amazingly quick reply, and it works perfectly.

ben_josephs, you are much appreciated.

Thanks!
Post Reply