• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Lesson 14. Using Find and Replace > Finding Variations in a Name

Finding Variations in a Name

You can also look for variations in a name. For example, some of these lighthouses are located in California, but the name of the state is written in various formats throughout the page: ca, Ca, california, and California. You want to make the format consistent and change it to California.

In the ca_lights.html document, choose Edit > Find and Replace. Change Search For to Text and type C\w* built in the Search For text field.

The \w searches for any alphanumeric character after the C, and the asterisk means you want to find any number of alphanumeric characters. Adding “built” limits the search even further by causing Dreamweaver to search for instances that match C\w* and which are followed by the word “built.” For instance, “C\w* built” will find “Ca built,” “California built,” and other variations of the character 'C' followed by any number of alphanumeric characters and the word “built.” If you were to leave off “built”, the search would also find items such as “Cape” and “Cabrillo” in the document.

In the Options, make sure Match Case is unchecked and check the Use Regular Expressions box.

If Match Case were selected, then the search would be limited to finding only words that begin with an uppercase C. In this exercise, you want to find both the uppercase and lowercase instances of California, so you are leaving Match Case unchecked.

In the Replace With text field, type California built. Place the insertion point at the beginning of the text in the document window, click Find Next to find the first occurrence, and then click Replace to change it.

The first version of the state name is found in this document and replaced with California.

Dreamweaver selects the second instance of a “c” followed by “built”: “chusetts built.” You don't want to change this one because it is not a version of the CA state name.

Click Find Next. Continue to replace all the remaining versions of the CA state name. Save the ca_lights.html document.

You can close this document and the Results window.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint