I have a long list of these types of lines

Blueshield BSC500
Blue Shield Shieldspectrum500

there are about 150 of them with each line slightly different,

what I would like to end up with is lines like

<A HREF="Blueshield_BSC500.html">Blueshield BSC500</A>

note thatspace is now an underscore.

Is there a series of GREP find/replaces that will make this happen?

Assuming that what you want can be specified as:

Take the existing line, called it X.
Take X and convert all spaces to _, call it Y.
Produce the line
<A HREF="[Y].html">[X]</A>

And that X never contains any other characters that might cause trouble in a URL.

Then you can do that easily in two passes.

First, search for

(.*)

replace with

<A HREF="\1.html">\1</A>

Next, search for

(".*) (.*")

replace with

\1_\2

Repeat that search and replace until there are no matches.

Note that if there are any quotes (") in X, then you will need to do more work.

Also, as you probably know, XHTML uses lower case, while HTML is case insensitive, so using <a href...>...</a> would likely be better, but that is a whole different story.

Enjoy,
   Peter.

--
Check out Interarchy 8.2, just released, now with Growl support.
<http://www.stairways.com/>  <http://download.stairways.com/>

--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to