Maintenance

  • Home
  • Log in
  • « Windows 7 install testing
  • New iMac purchased »

Regular expressions

Posted by gregster on 30 Apr 2009 in R & D, Activity log

I had cause to build a static page of links from a directory listing, and used Text Wrangler and grep to do it.

From an initial directory listing I got a bunch of stuff that looked like this:
link-01.html
url_03.html
href9.html

I'm sure there's a one-pass method for this, but I did it in two.
First pass: prepend text with <a href="
Second pass:
Find (^.*")(.*)(\.html)
Replace with \1\2\3">\2</a>
Receive <a href="link-01.html>link-01.html</a>

This entry was posted by Greg and filed under R & D, Activity log.

Maintenance

This blog is the location for all work involving software and hardware maintenance, updates, installs, etc., both routine and urgent.
  • Home
  • Recently
  • Archives
  • Categories

Search

Categories

  • All
  • Announcements
  • Hit by a bus
  • Labs
    • Activity log
    • Documentation
  • Notes
  • R & D
    • Activity log
    • Documentation
  • Servers
    • Activity log
    • Documentation
  • Tasks

All blogs

  • Academic
  • AdaptiveDB
  • Admin
  • Announcements
  • CanMys
  • Cascade
  • CGWP
  • ColDesp
  • Depts
  • DVPP
  • Endings
  • HCMC Blogs
  • Landscapes
  • LEMDO
  • Linguistics
  • Maint
  • LondonMap
  • Mariage
  • MoM
  • Moses
  • Pro-D
  • Projects
  • ScanCan
  • HumsSites
  • Wendat

This collection ©2026 by admin • Help • Responsive CMS