Free Regular Expression Queries for Expression Web

NB: Expression Web Queries are wonderful tools but they must be used with caution less you overwrite huge portions of your site that you didn't mean to.

*****ALWAYS make a backup before running queries****

To download a query

Right click the Download link for the query you wish to use (see below) in the browser (of choice) window, and choose  'Save Target As' or 'Save link as'. The message you see will depend on which browser you are using. Where it says 'Save in' (or locate in the folders pane in Vista) browse to the default location of queries in your version of Expression Web.

NOTE: Read our Expression Web Queries Tutorial for more information about how to run, write, share and save a query.

N.B. If you want to download one of the zipped bundles below please see that section for download instructions.

It is a good idea to get an general feel of what you are up against.

Download the following

First run the query: Find-any-tag-with-attribute-any-attribute-contains-any-value

This will show you ALL tags, however there will be many you don't want to remove.

Use this query merely to produce results which you can then sort by clicking the 'Matched Text' column header. (This will sort them into similar selections so you can 'read' the results more easily.) (see Expression Web Querys Tutorial)

IMPORTANT: This query is to be used as a tool ONLY, if you were to implement it you might lose things you don't want to like hyperlinks.

Note all the one's you want to get rid of. In my selection I have

table - border
td - width
b - bold
i - italic
u - underline
img - borders of varying values

So I shall certainly be using most of the query bundles. There are six bundles, plus the general find query above. If you have an idea for a query please contact us.

Fig 1 - Query folders

NOTE: When you have a lot of queries it can get untidy and be hard to find your query, so I suggest making new folders in the Queries folder location I have entitled mine according to the bundle names e.g. Queries-table this is why the queries are set out in separate bundles, however I have put them all into a super bundle if you wish to dl them that way.

Cleaning Query bundles

All the queries are free to download and use are in a password protected folder

USERNAME: bundles
PASSWORD: BUNDles111*

1. Click on the links for each bundle below, use the above user name and password to enter the site and begin the download.

2. When the download  begins, a box may pop up asking if you want to save or open with your Zip program. Make sure you SAVE the eBook (in a location that you can find) rather than open it at this point.

3. Once you have it downloaded, Open the containing folder and either right click and press Open with Winzip (or your zip program) our double click on the .zip file you have just downloaded.

4. When it comes to selecting a place to unzip the zip file, you need to navigate to your Queries Folder.  

NOTE: If you do not have a Queries folder just make a folder called Queries. If the path is not exactly the same for your version as below it is quite intuitive and the below paths should give you a clue.   Where C: is your drive (change if you have a different drive letter) and Tina is your user name (change to your user name)

C:\Users\Tina\AppData\Roaming\Microsoft\Expression\Web Designer This is the path for EW 1.0 users
C:\Users\Tina\AppData\Roaming\Microsoft\Expression\Web 2\Queries This is the path for EW 2.0 users
C:\Users\Tina\AppData\Roaming\Microsoft\Expression\Web 3\Legacy\Expression\Web3\Queries This is the path for EW 3.0 users
C:\Users\Tina\AppData\Roaming\Microsoft\Expression Web 4\Queries This is the path for EW 4.0 users

5. Press unzip and your queries will proceed to be downloaded to your Queries folder.

6. Now they will be available from within your Expression Web version.  

NOTE: These queries can be used for any Expression Web Version and SharePoint Designer 2007.

 

The TABLE CLEANING BUNDLE consists of 12 Expression Web table cleaning Queries which will remove the following attributes.

Whilst you might not always want to keep your tables as you should be moving to a div layout, you might need them in some situations for data tables.

  • align
  • bcolor
  • border
  • bordercolordark
  • bordercolorlight
  • cellpadding
  • cellspacing
  • class
  • height
  • id
  • style
  • width

The CELL TD CLEANING BUNDLE consists of 11 Expression Web Cell TD Cleaning Queries which will remove the following attributes *

  * Same selections as the Cell TH Cleaning bundle attributes

The CELL TH CLEANING BUNDLE consists of 11 Expression Web Cell TH Cleaning Queries which will remove the following attributes *

  • align*
  • bcolor*
  • bordercolor*
  • bordercolordark*
  • bordercolorlight*
  • class*
  • height*
  • id*
  • style*
  • valign*
  • width*

The BODY CLEANING BUNDLE consists of the following 12 Expression Web Body Cleaning Queries which will remove the following attributes

  • alink
  • background
  • bcolor
  • bottomargin
  • class
  • id
  • link
  • onload
  • style
  • text
  • topmargin
  • vlink

The TEXT TAG CLEANING BUNDLE consists of 5 Expression Web Text Tag Cleaning Queries 'b', 'strong', 'i', 'em' and 'u', either removal of 'b' and 'i' for 'strong' and 'em' or just the removal of 'i', 'b' and 'u'.

The text tags of 'b', 'i' and 'u' for Bold, Italic and Underline are all now deprecated from the current specification . Instead one should have <strong> </strong> for 'b' = bold, <em> </em> for 'i' = Italic and u should now be used as a style using text decoration. It should NOT to be used to underline text within content as it can be mistaken for a hyperlink, it is best reserved for headings and side headings. More about text decoration - underline.

The MIXED CLEANING BUNDLE consists of 2 Expression Web Mixed Cleaning Queries which include;

The Font remove tag Query can find all the font tags with any attribute that contains any value and remove the tag and the attributes.

NOTE: It pays to run the query a few times as it finds different font selections to remove.

The Image remove border Query will find all img tags and remove the attribute border which contains any value, 1,2,3 etc.

The World Wide Web Consortium now regards the attribute 'border' as outdated. Newer constructs are recommended. Meaning you should have this style in your .css sheet which will set a value of 0px for every image within your site. Borders for images should be applied in your graphic editor of choice.

body img {

border: 0px;
}

The SUPER BUNDLE consists of all the above bundles

Just in case you wanted to download them all at once all the queries are available in a Super Expression Web Query Bundle.

More Free Expression Web Queries

  1. Add Title Attribute not including img or name - (See * below)
  2. Add Title Attribute not including img - This query does the same as #1 only it does not include within the search images (img) but does include bookmarks (name) within the search.
  3. Add Title Attribute - This query does the same as #1, however it does not include bookmarks and images within the search.

The Add title attribute with no img or name Query will find all 'a' tags excluding 'img' tag and 'name' tag and add a Title Attribute code

find and replace insert title.Fig 2 - To Pane *

This query runs a Find on all 'a' tags that do not have a Title Attribute, but excludes 'a' tags (hyperlinks) that are attached to a 'img' tag or a 'name' (bookmark) tag. After the query has run, you can then proceed to work through each link and there is no need to go to the page select the hyperlink and open the hyperlink dialog box and open the Screen Tip button or even insert your title attribute in code view. You can do it through the Find and Replace dialog box one link at a time.

After running the query select the first result, then select 'Current Page' observe what the hyperlink is about and in the 'To' pane merely type in what you want the Title Attribute to read. e.g. On our example graphic (See Fig 2) we have the sitepoint.com hyperlink so I have typed in the 'To' pane Sitepoint, then hit the 'Replace' button.

NOTE: Be very careful about what you are doing, you do NOT want ALL your hyperlinks to have a empty title attribute or worst all be inserted with text that's the same, so be careful NOT to select the 'Replace All' button. This is not an operation you do without focusing upon.

Firefox links without titles.If you want to double check your page you might like to use the Firefox web developer add-on. On the Outline menu - Outline Links - Links without Title Attributes, after you have selected this it will highlight any links on page that do not have a title attribute, if you don't see any you have found them all.

Find and implement

Finding all instances of xthumbnail-orig-image comment

find replace xthumbnail.The setting 'Tracing Image and Interactive Button attributes' is selected under 'Remove Generated HTML' on the 'Optimize HTML' Dialog box. (This setting is suggested when you follow the Setting up Expression Web EBook.) Which is run in 'Code View' by right clicking and select 'Optimize HTML' and this will remove any left over commenting code generated when you make a thumbnail in Expression Web. However, this can only be done on the page not globally. If you are in the habit of forgetting to remove this commenting code, you can verify your pages are clean by running a Find for xthumbnail-orig-image on all your pages. Just make sure you select 'Find in Source Code'. You can then run the 'Optimize HTML' dialog box in 'Code View' to remove each instance on each of the pages they appear on. Unfortunately I have been unable to devise a query that would remove these globally. Yet!