HTML and CSS Reference
In-Depth Information
<li>([a-z]+)</li>
I replaced it with this:
<li><code>\1</code></li>
This gave me the following:
<ul>
<li><code>marquee</code></li>
<li><code>basefont</code></li>
<li><code>bgsound</code></li>
<li><code>keygen</code></li>
<li><code>bgsound</code></li>
<li><code>spacer</code></li>
<li><code>wbr</code></li>
</ul>
As another example, suppose you have a table of species count data organized like this:
<tr> <td> Great Egret </td> <td> 7 </td> </tr>
<tr> <td> Redhead </td> <td> 1 </td> </tr>
<tr> <td> Mallard </td> <td> 56 </td> </tr>
<tr> <td> House Finch </td> <td> 3 </td> </tr>
Now suppose you decide to swap the columns so that the counts go on the left and the species on the right. You
search for this:
(<td>.*</td>) (<td>.*</td>)
Then you simply replace it with the following:
\2\1
This very quickly turns the HTML into this:
<tr> <td> 7 </td><td> Great Egret </td> </tr>
<tr> <td> 1 </td><td> Redhead </td> </tr>
<tr> <td> 56 </td><td> Mallard </td> </tr>
<tr> <td> 3 </td><td> House Finch </td> </tr>
Groups and back references are critical anytime you need to chop data apart and put it back together again in a
slightly different order.
Search WWH ::




Custom Search