On 22 Nov 2007, at 02:23, Keith Rettig wrote:

How do I make BBEdit do Markup:Utilities:Make Tags Lower Case to all 195 documents I have open?

I think I'd do this with Find/Replace.

If you do your Find expression something like this:

    (?i)<(img|p|h1|h2|h3)

putting every tag you can think of separated by | and in between the ( and )

    (?i) makes the Find case insensitive.

    | means "or"

( and ) are either side of the series of | to define where the "or" options begin and end.

Then you have your replace expression:

    \L&

This will replace everything found and convert letters to lower case.

An alternative would be to not identify the tag contents in the Find expression and use <[a-zA-Z]+ instead but personally I feel better about being specific about the tags.

You could specify the tags as I've described in first search expression, then do a search for:

    <.*?[A-Z]+

to find any tags that have an uppercase character or more but which you've not thought of.

Personally I like to be specific as in the first Find expression then do a quick check for any that you've not included rather than be non- specific and accidentally change things you don't want to change.

When changing closed files there is no "undo"!

And what is the best way to fix all of the tags by ensuring that all parameters have quotes around them?
For instance, I want to ensure
<img src="../nj_smp1.gif" alt="2001 Symposium" border=0 height="15" height=20 width=60>
is
<img src="../nj_smp1.gif" alt="2001 Symposium" border=0 height="15" height="20" width="60">

I've just tried out:

Find: ="?(\d\d?)"?(\s|>)

Replace: ="\01"\02

which seems to work on your example.

A brief explanation:

In Find expression left to right:

    = is indeed =

    "? is if there is a " or not

    \d is a digit

    \d? is if there is a second digit or not

    "? is if there is a " or not again

    \s is a white space character

    | is or

    > is indeed >

The brackets are to match with replace expression

In Replace expression we keep \d\d from Find but put " on each side.

We also keep the white space character or > at the end.

Patrick

--
------------------------------------------------------------------
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