Expression Web Querys - Regular Expression Querys

Tina Clarke


Query's should be used when either you use a particular search pattern frequently or query criteria are a little too complicated to remember or figure out easily. Used alongside Regular Expressions which become useful when the exact coding is not known or differs, they consist of specific and special characters that describe the pattern of text. Query's can save you so much time on cleaning up your pages and on maintenance. For those that do not wish to learn how to make their own we offer a bundle of Expression Web Query's that can do all manner of quick clean up jobs and guide you to finding all the locations on your website that need a particular item changing.

 

How to write a query

Expression Web Query with regular expression for Finding missing Title Attributes

On the menu select Edit - Replace or use the keyboard shortcut Control +H

Click the 'HTML Tags' Tab, on the 'Find Tag' pane click the drop down arrow and select the 'a' tag.

Find Tags.

 

 Fig 1 - Find Tag

 

On the 'Replace action' pane select 'Set attribute value'.
On the 'Attribute' pane select 'title', on the 'To' pane leave it blank.

HTML Rules.

 

 Fig 2 - HTML Rules

 

Next click the 'HTML Rules' button and the 'HTML Rules' Dialog box will appear. Click 'New Rule' and the 'New Rule' drop down box will appear at the bottom, click the drop down arrow and select 'Without attribute', in the next pane select 'title' and press ok

Next press the 'Save Query' Icon and the 'File Save' Dialog box will appear with the Queries folder already selected. (If not just make a folder called Queries and navigate to:

Where C: is your drive (change if you have a different drive letter) and Tina is your user name (change to your user name) Type in the name of the query you have just made, I've called mine add-title-attribute and the file will be saved with the extension .fpq.

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

Save Query

 

 Fig 3 - Save Query

 

Next select 'All Pages' under Search OptionsFind Where: Then Press the 'Find All' Button

Find and Replace - Find All.

 

 Fig 4 - Find and Replace - Find All

 

Expression Web proceeds to run the query and find all the hyperlinks on your website that do not contain a Title Attribute.

Expression Web Query with regular expression for Finding missing Title Attributes excluding name and img tags

However along with normal hyperlinks, bookmarks (name) and images (img) also appear in the listing. it is a simple matter to add a few new rules to exclude these.

Set up as above first when it comes to the html rules section follow the below.

Click the 'html rules' button select 'Find Tag' then 'New Rule', on the first pane select 'not containing', on the next pane select 'Tag' and lastly 'img'.

Next

Click 'New Rule' once more and select 'Without attribute', and on the next page select 'name' then press ok.

Now the query will find all missing Title Attributes for hyperlinks but not bookmarks or image links.

Refining your Search for missing Title Attributes

You can now make more tweaks to further refine your search for missing Title Attributes by selecting the down arrow on the columns in the Find results. By selecting the Custom AutoFilter you can eliminate two pages or folders that you don't wish have in your results.

Custom

 

Fig 5 - Custom Results

 

You can also sort your results in Ascending or descending order just by clicking the column. By right clicking in the Find Results Task pane you also have a number of menu features available such as:

  • :Go to Page
  • Find and Replace
  • Select Resulting Files in Folder List
  • Clear Results
  • Refresh changed Results
  • Copy Results
  • Remove Filters

Running a Query

Query File.

 

 Fig 6 - Query File

When you come to use The 'Find and Replace' Dialog box again, you will need to select the query you want to use, do this by clicking the 'Open Query' Icon on the 'HTML Tags' Tab, and select the query in the 'File Open' Dialog box then press Open.

You can check you have selected the correct query as the text describing it will display next to the 'Clear Rules' button.

For this particular query it will say

Without attribute: title
Not containing tag: <img>...

Sharing a Query

Expression Web saves queries under the below paths

NOTE: Using Windows Vista Ultimate (If you have a different version of Windows the path will be somewhat similar and intuitive with similar names.)

 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

(where C is the drive in use and Tina is the user - change Tina for your own user name) by default, but they can be saved to a easier to remember location. All queries are saved with the .fpq file extension and you can open them in notepad.

NOTE: You can simply navigate to the correct location via Import under File and select the .fpq files you want to share, then link to them via the page you want to share.

Opening a .fpq in notepad

Open a browser window and insert the location of your queries for our example we are using the default location, as I mentioned above change the user name to yours.

In the browser window pane Right click on the query you wish to open and choose 'Open', if you are opening a .fpq file extension for the first time notepad might not be associated with it and you now have a windows dialog box asking which program you would like to open it with, choose the 'Select a program from a list of installed programs' and press ok. Scroll down till you find Notepad and select it, make sure the 'Always use the selected program to open this type of file' radio button is ticked and press ok.

Open With.

 

Fig 7 - Open With

Notepad will then open and the query will be displayed as a xml file. You can then save the file.

e.g.

<?xml version="1.0" encoding="utf-8" ?>
<fpquery version="1.0">
<queryparams regexp="true" />
<find tag="a">
<rule type="attribute" attribute="title" compare="=" value="" negate="true" />
<rule type="containsTag" tag="img" negate="true" />
<rule type="containsTag" tag="" negate="true" />
</find>
<replace type="setAttribute" attribute="title" value="" />
</fpquery>

In notepad go to File | Save As where it says 'Save as Type' change to 'All Files' and name the file, browse to the web you want to save it in and press save. Link to the files you wish to make available from within the page in your website

For those that don't wish to make the query I have discussed above then they can obtain it from:

Add Title Attribute not including img or name (More free Query's)

See the next section for how to save the query and run it.

Saving a Query from a third party

Right click the Download link for the query you wish to use below in the browser window, and choose  'Save Target As' or 'Save link as'. Where it says 'Save in' (or locate in the folders pane in Vista) click the arrow on the drop down and browse to the default location  -  (see above under Sharing a Query for more Details on the location) and see Running a Query for more information on how to run it.

Free Expression Web Queries

Please see the Regular Expression Queries for more details. We offer the following Free Query bundles.

  1. TABLE CLEANING BUNDLE
  2. CELL TD CLEANING BUNDLE
  3. CELL TH CLEANING BUNDLE
  4. BODY CLEANING BUNDLE
  5. TEXT TAG CLEANING BUNDLE
  6. MIXED CLEANING BUNDLE
  7. SUPER BUNDLE - All of the above

More Free Query's available from Any Expression Web Designs

The Expression Web Query's below are written by Tina Clarke of Any Expression Web Designs Copyright © 2008 - 2011 and are available for our readers use

  1. Add Title Attribute not including img or name - This query searches for hyperlinks that do not contain the Title Attribute (Title Tag), but does not include within the search image or bookmark hyperlinks. It will also insert the Title Attribute code e.g. title= " " so that you can then insert the title you wish right there and then in code view.
  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 following query is available with the newly launched Expression Web Tips Ebook Vol ll as a bonus with Tip 49 the launch price of the ebook is $7 or you can obtain both the Expression Web Tips Ebook Vol l AND Vol ll for $13

NOTE: Find and Replace any border size Query is available free to owners of Migrating from FrontPage to Expression Web eBook

Find and Replace any border size Query - This query searches for any images that include the code tag border="#" where # is 0 or any other number and removes it. This is deprecated code and should be replaced with a style in your external sheet. e.g. 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;



If you have any ideas for query's please do not hesitate to email me.
Tina Clarke Signature.
Cheshire Web Designs - Cheshire website Designs by Any Expression Web Designs
Owner Any Expression Web Designs and Clarke Abstract Art

Copyright © 2006 - 2021 Tina Clarke of Any Expression Web Designs All Rights Reserved

Are you looking for a Web Designer?
Web Designs created by Any Expression Web Designs