Ektron CMS400.Net Reference

>>Helping Users Navigate Your Web Site > Creating User-Friendly URLs with Aliasing > Using RegEx Expressions

Using RegEx Expressions

RegEx expressions allow site visitors to enter a human-readable URL into the browser address field and transform that entry into the query string component of an Ektron CMS400.NET page. The benefit is that the site visitor can “guess” other pages based on an easily recognizable pattern.

For example, a RegEx expression aliases blogs.aspx?blogmonth=3&blogyear=2006&blogid=41 as blogs/2006/03/41. From that, a site visitor can infer that he can enter blogs/2006/03/40 to see the previous post, enter blogs/2006/03 to see all March 2006 posts, etc.

This section provides a description of the screen’s fields, then a step-by-step explanation of how to create and validate a RegEx expression.

Add a RegularExpression Screen

To access the Regular Expression screen, follow these steps.

See Also: Using RegEx Expressions; Instructions for Creating a RegEx Expression

1. In the Ektron CMS400.NET Workarea, go to Settings > Configuration > URL Aliasing > RegEx.

2. Click Add ().

3. The Add a Regular Expression screen appears.

4. Use the following table to complete the screen.

Field

Description

For more information, see

Active

Check this box to activate the expression. If the expression is
active, site visitors can enter an aliased URL to access a page on your site.

For example, they can enter
www.example/com/blogs/2006

/03/41 to access a blog page even though the actual URL is www.example/com/blogs/
blogs.aspx?blogmonth=3&

blogyear=2006&blogid=41

 

Expression Name

Assign an easily recognizable name to this regular expression. It appears on the RegEx Aliased Page Name Maintenance screen to help users identify it.

 

Expression

Enter a RegEx expression that will replace the variables (for example, $1, $2, etc.) in the Expression map.

If you want to insert a question mark into the Expression, you must precede it with a backslash (\).

Instructions for Creating a RegEx Expression

http://regexlib.com/

Expression Map

Enter a map of original URL elements. The map lets you replace query string parameters with variables, such as $1, $2, etc. As a result, a site visitor can identify any page that uses this pattern by changing the variable values.

You can click Expression Library to view examples of RegEx expression maps. To copy any map that resembles your page pattern, click it. You can then modify is as necessary.

Instructions for Creating a RegEx Expression

Example URL

Displays an example of Web page that follows this pattern.

 

Priority

Assign a priority to this expression from the following choices.

high

medium

low

none

Assign high to expressions that will be used most frequently.

This field helps the aliasing feature respond quickly when site visitors enter expressions into the browser address field. This is because aliasing first tries to match a site visitor’s entry with high priority expressions, then medium, then low.

 

Requested URL

Enter a user-friendly pattern that site visitors can insert to access pages on your site. This pattern replaces the query string component of a URL.

For example, blogs/2006/03/41.

Instructions for Creating a RegEx Expression

Transform button

After completing all fields on the screen except Resulting URL, use this button to check the validity of the Expression, Expression Map and Requested URL fields.

 

Resulting URL

Values appear in this field after you click the Transform button. It uses the Expression and Expression Map field values to translate a Requested URL (one a site visitor will enter) into a Resulting URL (the page’s actual query string parameter).

 

Instructions for Creating a RegEx Expression

Use the following steps as a guide to creating a Regex expression.

1. Find a site page (such as a blog) whose query string parameters allow users to guess similar pages using a pattern. For example

http://ecmintranet/blogs.aspx?blogmonth=3&blogyear=2006

2. In the Ektron CMS400.NET Workarea, go to Settings > Configuration > Url Aliasing > RegEx.

3. Click Add a Regular Expression ().

4. Give your expression a name.

5. Click Expression Library.

6. Find and click an Expression Map similar to the page you found in Step 1. To continue our example, choose

PageName.aspx?year=$1 & month=$2

7. The Expression and Example URL field values fill in, using information from the Expression Map.

8. As needed, adjust the values in the Expression map or the RegEx expression to match your page name. For example, change PageName to blogs, and delete Default.aspx.

See Also: http://regexlib.com/

9. To continue the example, change the Expression Map field so that it looks like this.

10. Click Transform to verify that the resulting URL matches the original page pattern. If it does not, check all steps, especially the Expression field.

Viewing a Regular Expression

To view a regular expression, follow these steps.

1. In the Ektron CMS400.NET Workarea, go to Settings > Configuration > URL Aliasing > RegEx.

2. Click the expression whose information you want to view.

To learn more about the fields on the screen, see Use the following table to complete the screen..

See Also: Using RegEx Expressions

Editing a Regular Expression

To edit a regular expression, follow these steps.

1. In the Ektron CMS400.NET Workarea, go to Settings > Configuration > URL Aliasing > RegEx.

2. Click the expression whose information you want to edit.

To learn more about the fields on the screen, see Use the following table to complete the screen..

See Also: Using RegEx Expressions

Deleting a Regular Expression

To delete a regular expression, follow these steps.

1. In the Ektron CMS400.NET Workarea, go to Settings > Configuration > URL Aliasing > RegEx.

2. Click Delete ().

3. Check the box next to the expression you want to delete.

4. Click Delete ().

See Also: Using RegEx Expressions


Visit the Ektron Dev Center at http://dev.ektron.com 1-866 - 4 - EKTRON

Ektron CMS400.NET Reference Version 8.02 SP1 Rev 1

Ektron Documentation,© 2011 Ektron, Inc.