Loading ...
Sorry, an error occurred while loading the content.

A question on ALT and TITLE html tags within IMG SRC=

Expand Messages
  • Joel Siegfried
    Hello to everyone here, I am a commercial web designer and a registered user of Note Tab Pro v4.95. I hope you might be able to help with with the following
    Message 1 of 5 , Mar 24, 2004
    • 0 Attachment
      Hello to everyone here,

      I am a commercial web designer and a registered user of Note Tab Pro v4.95.

      I hope you might be able to help with with the following html text editing
      problem:

      I have hundreds of web pages which I would like to update to add TITLE=
      tags to each and every ALT= tag entry, that is to use both ALT and TITLE
      tags within IMG SRC= descriptions. Is there a copy string command which
      will leave all the ALT tags intact and add TITLE tags with the same ALT tag
      strings?

      Of course, I know how to search & replace "alt=" with "title=" , but I
      don't know how to add the same title tags, except manually. I have tried
      various search & replace strategies, yielding such output as ALT&Title=,
      ALT/Title=, ALT+Title=, but these don't display in browsers. The correct
      HTML format is ALT="abc" (space) TITLE="abc". To do this manually would take
      hundreds of hours of work, and would not be cost effective.

      Thank you for your assistance.

      Cheers,

      Joel
    • Marcelo de Castro Bastos
      ... Well, there is a way. It involves regular expressions. It would go like this: search for: alt= {[^ ]+} replace with: alt= 1 title= 1 The only problem
      Message 2 of 5 , Mar 25, 2004
      • 0 Attachment
        On 24/3/2004 23:55, Joel Siegfried invited the wrath of the gods by saying:

        >Hello to everyone here,
        >
        >I am a commercial web designer and a registered user of Note Tab Pro v4.95.
        >
        >I hope you might be able to help with with the following html text editing
        >problem:
        >
        >I have hundreds of web pages which I would like to update to add TITLE=
        >tags to each and every ALT= tag entry, that is to use both ALT and TITLE
        >tags within IMG SRC= descriptions. Is there a copy string command which
        >will leave all the ALT tags intact and add TITLE tags with the same ALT tag
        >strings?
        >
        >Of course, I know how to search & replace "alt=" with "title=" , but I
        >don't know how to add the same title tags, except manually. I have tried
        >various search & replace strategies, yielding such output as ALT&Title=,
        >ALT/Title=, ALT+Title=, but these don't display in browsers. The correct
        >HTML format is ALT="abc" (space) TITLE="abc". To do this manually would take
        >hundreds of hours of work, and would not be cost effective.
        >
        >
        >
        Well, there is a way. It involves regular expressions.
        It would go like this:
        search for:
        alt="{[^"]+}"
        replace with:
        alt="\1" title= "\1"

        The only problem I see is that Notetab has trouble doing very big regexp
        search & replaces -- although I don't envision this being a problem with
        ALT and TITLE fields (how many images can be in a page, anyway? Couple
        hundred would already be way overdoing it...). If there are that many
        files, you might be better off using a specialized search & replace tool
        anyway, which will process an entire folder, tree or disk. Many of them
        will do regular expressions.

        --
        Marcelo de Castro Bastos
      • Don - htmlfixit.com
        Appears to be an excellent way to go about it. Very nice suggestion. If you open a bunch of the documents at once, check do all open documents and you should
        Message 3 of 5 , Mar 25, 2004
        • 0 Attachment
          Appears to be an excellent way to go about it. Very nice suggestion.
          If you open a bunch of the documents at once, check do all open
          documents and you should be off to the races.

          If it were me, however, I would ask the question on the clips list as a
          clip would do it much more effectively. You could verify that you are
          in an image tag, that the tag doesn't already contain a title tag, etc.
          You could then do the replace. You could have it step through all
          files in your directory.

          Subscribe to the clips list and ask the same question!

          Don
          >>
          >
          > Well, there is a way. It involves regular expressions.
          > It would go like this:
          > search for:
          > alt="{[^"]+}"
          > replace with:
          > alt="\1" title= "\1"
          >
          > The only problem I see is that Notetab has trouble doing very big regexp
          > search & replaces -- although I don't envision this being a problem with
          > ALT and TITLE fields (how many images can be in a page, anyway? Couple
          > hundred would already be way overdoing it...). If there are that many
          > files, you might be better off using a specialized search & replace tool
          > anyway, which will process an entire folder, tree or disk. Many of them
          > will do regular expressions.
          >
        • Alec Burgess
          Joel Following should work Find: alt= {[^ ]*} Replace: alt= 1 title= 1 [x] Regular Exp Note: Normally one could look for alt= {.*} but that would match
          Message 4 of 5 , Mar 25, 2004
          • 0 Attachment
            Joel
            Following "should" work

            Find: alt="{[^"]*}"
            Replace: alt="\1" title="\1"
            [x] Regular Exp

            Note: Normally one could look for alt="{.*}" but that would match everything
            after the first " until the last if more than one quoted field was on a
            line. By using "{[^"}" we match everything from inital quote - everything
            *NOT* quote - ending quote.

            Then in replace what's in the {---} pair has been stored in variable \1

            Reading the Regexp page in help and playing around with it should make
            variants of this "easy" :-)

            FYI: here is the one line clip that does the same thing

            H="dup ALT tag to TITLE"
            ^!replace "alt="{[^"]*}"" >> "alt="\1" title="\1"" rwsa

            Regards ... Alec
            --

            ---- Original Message ----
            From: "Joel Siegfried" <ecto@...>
            To: <ntb-html@yahoogroups.com>
            Sent: Wednesday, March 24, 2004 21:55
            Subject: [klb: [NH] A question on ALT and TITLE html tags within IMG
            SRC=

            > Hello to everyone here,
            >
            > I am a commercial web designer and a registered user of Note Tab Pro
            > v4.95.
            >
            > I hope you might be able to help with with the following html text
            > editing problem:
            >
            > I have hundreds of web pages which I would like to update to add
            > TITLE= tags to each and every ALT= tag entry, that is to use both ALT
            > and TITLE tags within IMG SRC= descriptions. Is there a copy string
            > command which will leave all the ALT tags intact and add TITLE tags
            > with the same ALT tag strings?
            >
            > Of course, I know how to search & replace "alt=" with "title=" , but I
            > don't know how to add the same title tags, except manually. I have
            > tried various search & replace strategies, yielding such output as
            > ALT&Title=, ALT/Title=, ALT+Title=, but these don't display in
            > browsers. The correct HTML format is ALT="abc" (space) TITLE="abc".
            > To do this manually would take hundreds of hours of work, and would
            > not be cost effective.
          • Joel Siegfried
            Dear Alec, Don, Antonio, Jody, and any others who may have responded, I cannot thank all of you enough for posting this brilliant solution. In a few minutes I
            Message 5 of 5 , Mar 26, 2004
            • 0 Attachment
              Dear Alec, Don, Antonio, Jody, and any others who may have responded,

              I cannot thank all of you enough for posting this brilliant solution.
              In a few minutes I made some 20,000 changes in over 750 html files
              using the Regular Exp search and replace function, which worked
              flawlessly. The explanation of what the coding means and how it works,
              and having a clip available to try out in the future were added
              bonuses. It is so great to belong to such a sharing and supportive
              community.

              I've already shared this information with friends and colleagues who
              said that it couldn't be done!

              Thank you all.

              Cheers,

              Joel


              --- In ntb-html@yahoogroups.com, "Alec Burgess" <burale@a...> wrote:
              > Joel
              > Following "should" work
              >
              > Find: alt="{[^"]*}"
              > Replace: alt="\1" title="\1"
              > [x] Regular Exp
              >
              > Note: Normally one could look for alt="{.*}" but that would match
              everything
              > after the first " until the last if more than one quoted field was on a
              > line. By using "{[^"}" we match everything from inital quote -
              everything
              > *NOT* quote - ending quote.
              >
              > Then in replace what's in the {---} pair has been stored in variable \1
              >
              > Reading the Regexp page in help and playing around with it should make
              > variants of this "easy" :-)
              >
              > FYI: here is the one line clip that does the same thing
              >
              > H="dup ALT tag to TITLE"
              > ^!replace "alt="{[^"]*}"" >> "alt="\1" title="\1"" rwsa
              >
              > Regards ... Alec
              > --
              >
              > ---- Original Message ----
              > From: "Joel Siegfried" <ecto@c...>
              > To: <ntb-html@yahoogroups.com>
              > Sent: Wednesday, March 24, 2004 21:55
              > Subject: [klb: [NH] A question on ALT and TITLE html tags within IMG
              > SRC=
              >
              > > Hello to everyone here,
              > >
              > > I am a commercial web designer and a registered user of Note Tab Pro
              > > v4.95.
              > >
              > > I hope you might be able to help with with the following html text
              > > editing problem:
              > >
              > > I have hundreds of web pages which I would like to update to add
              > > TITLE= tags to each and every ALT= tag entry, that is to use both ALT
              > > and TITLE tags within IMG SRC= descriptions. Is there a copy string
              > > command which will leave all the ALT tags intact and add TITLE tags
              > > with the same ALT tag strings?
              > >
              > > Of course, I know how to search & replace "alt=" with "title=" , but I
              > > don't know how to add the same title tags, except manually. I have
              > > tried various search & replace strategies, yielding such output as
              > > ALT&Title=, ALT/Title=, ALT+Title=, but these don't display in
              > > browsers. The correct HTML format is ALT="abc" (space) TITLE="abc".
              > > To do this manually would take hundreds of hours of work, and would
              > > not be cost effective.
            Your message has been successfully submitted and would be delivered to recipients shortly.