Tricky find/replace within <A HREF> tags

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Tricky find/replace within <A HREF> tags

    I need to add a 'class = 'link' attribute to every <a
    href='http://www.somelinkthat is different ever time'> tag that my script is
    processing. So I guess what I need to do is find every a href tag, locate the
    last bracket and replace that last bracket with the new attribute, and then add
    the last bracket back. Tricky thing is, how do I isolate all the <a href>
    tags in the block of HTML that is being submitted, and then find the last
    bracket so that I can run the find/replace? Thanks for any suggestions.
    ChuckWWW

    ChuckWWW Guest

  2. Similar Questions and Discussions

    1. Using DW find to find tags not on page
      I transfering content from 1498 static pages into a MySQL database. I've isolated 1450 pages with single h1 or h2 tags that I can use in the title...
    2. Need help with Find & Replace
      Hiya. I've tried everything I know to find and replace text in 400+ documents and now need some help with it. This is the existing source code: ...
    3. find and replace options
      Hello all. I'm new to Contribute and would like to do a sitewide find and replace but can't figure out how to do this. Is it even possible in...
    4. find/replace
      when a user searched for a value with find/replace from a form he got the message the value could not be found but when I looked for it in the...
    5. find and replace everything between 2 tags
      Hello aronk, Backup the files first. Then set up Find and Replace to Find (there shouldn't be any line breaks): (<!DOCTYPE HTML PUBLIC...
  3. #2

    Default Re: Tricky find/replace within <A HREF> tags

    Well if your just adding a class to the href all you would need to do is.

    REPLACENOCASE(YourString, "<a", "<a class='link'", "ALL")



    "ChuckWWW" <webforumsuser@macromedia.com> wrote in message
    news:d0s23a$j3v$1@forums.macromedia.com...
    >I need to add a 'class = 'link' attribute to every <a
    > href='http://www.somelinkthat is different ever time'> tag that my script
    > is
    > processing. So I guess what I need to do is find every a href tag, locate
    > the
    > last bracket and replace that last bracket with the new attribute, and
    > then add
    > the last bracket back. Tricky thing is, how do I isolate all the <a
    > href>
    > tags in the block of HTML that is being submitted, and then find the last
    > bracket so that I can run the find/replace? Thanks for any suggestions.
    > ChuckWWW
    >

    Terry Bankert Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139