[Webchange-list] Search and Replace

Vince M Hudd vince at softrock.co.uk
Mon Jan 10 13:35:16 GMT 2011

Tim Hill <tim at timil.com> wrote:
> In article <gemini.let2bc0014t4e03yo.vince at softrock.co.uk>, Vince M Hudd
> <vince at softrock.co.uk> wrote:
> > Tim Hill <tim at timil.com> wrote:

> > I *think* the index numbers start from 1, and there are a maximum of 99.
> > Therefore, one of these should, I hope, do it:
> > The simplest would be:
> >  Replace: alt="*" 
> > With: alt="*1;" title="*1;"
> Your memory is slipping!  ;-)

Hmmm. Dealing with *ahem* real people *spit* a lot, I've noticed that it's
common for the concept of the first of anything being numbered as zero is
one that many people struggle to grasp, so I wondered if I'd had that in the
back of my mind when implementing that. I guess I either didn't, or I might
perhaps have a higher opinion of RISC OS users. 
> I am very pleased to report that the second attempt worked:

> Replace: alt="*" With: alt="*0;" title="*0;"
> Brilliant! Thanks.

Top stuff. :)

> > Or even avoiding wildcards altogether:
> >   Replace: alt= With: title=
> > Again, followed by the alt text inserter. Obviously, this last case
> > assumes alt= doesn't appear anywhere else in your html.
> In those cases, how would the original text find its way back 'into' the
> Alt tag?

I should have added that those approaches rest on the assumption that any
alt text is simply the leafname or a set text.

There *is* a way to use the alt text function and end up with meaningful
text, and that's to maintain a script where the first process is the alt
text insertion, and the rest a series of replaces - one for each image,
replacing its leafname (in an alt="*" context) with the appropriate
meaningful text.

The drawback is that for an image heavy site is that it can be slow - and
every time you add a new image, you need to add another replace to the
script. It's a bit too easy to forget to do that.

Vince M Hudd: http://misc.vinceh.com   Soft Rock: http://www.softrock.co.uk

More information about the Webchange-list mailing list