View Single Post
Old 08-17-2010, 04:52 PM   #21
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Oooops....

Quote:
Originally Posted by charleski View Post
I think you'll find it easiest to refactor the code using the regex I gave in my edit. You can then apply a style to h3 to align the titles separately (center or right would probably work best).
The regex looked like this:

Code:
Find: <h3 (.+)><img class="book"(.+)/>(.+)</h3>
Replace: <div class="clear"><div class="book"><img\2/></div><h3 \1>\3</h3></div>
Actually, that didn't go so well. The regex found the first incidence, "fixed" it, and then highlighted the entire rest of the page as the second incidence, which fortuitously I was doing one expression at a time, so was able to prevent it from nuking the entire page. What I have now looks thusly:

Code:
  <h2 id="heading_id_3">Picture Books (in Alphabetical Order):</h2>

  <div>
    <br />
  </div>

  <div class="clear">
    <div class="book"><img alt="" src="../Images/whenigrowup.gif" /></div>

    <h3 id="heading_id_4"><img class="book" alt="" src="../Images/howdoiloveyou_spanish.gif" />Come Te Amo? (Spanish)</h3>

    <div>
      <br />
    </div>

    <div>
      <br />
    </div>

    <h3 id="heading_id_5"><img class="book" alt="" src="../Images/christmasgrandmas.jpg" />Christmas at Grandma's House<br /></h3>
All the text that was part of the h3 heading, in the original, (if you compare the two books still shown in the code above, How Do I Love You and Christmas at Grandma's House, to the one that was altered, When I Grow Up, you'll see the difference in the before-and-after code) has vaporized, and the regex isn't recognizing individual occurrences of the expression, so I'd say something is wonky.

Somewhere, something in the (.+), I suspect, has gone awry, but as I'm not a regex expert, I'm not quite sure how to go about fixing this, as I don't know exactly what Charleski thought the output was going to be.

Thoughts, gang?

Hitch
Hitch is offline   Reply With Quote