Chapter 4. Regular Expressions on the Cisco Expressway

This chapter covers the following topics:

Images Overview and Use Cases for Regular Expressions: This topic will explain as an overview of the use of regular expressions within the Cisco Expressway.

Images Verifying Regular Expression using the Check Pattern Tool: This topic will recapitulate the use and validation of expressions using the Check Pattern Tool.

Chapter 4 focused on describing the use case of regular expressions within the Cisco Expressway and their ways of being utilized.

This chapter covers the following objectives from the Implementing Cisco Collaboration Cloud and Edge Solutions (CLCEI) exam 300-820:

Images 1.7.d Describe Expressway Core dial plan elements - Regular expressions

Images 2.2.d Configure Expressway Core dial plan elements - Regular expressions

“Do I Know This Already?” Quiz

The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 4-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A, “Answers to the ‘Do I Know This Already?’ Quizzes.”

Table 4-1 ”Do I Know This Already?” Section-to-Question Mapping

Images

Caution

The goal of self-assessment is to gauge your mastery of the topics in this chapter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving yourself credit for an answer you correctly guess skews your self-assessment results and might provide you with a false sense of security.


1. Which regular expression syntax does the Cisco Expressway utilize?

a. Perl

b. Python

c. PCRE

d. POSIX

2. Which of the following string would the expression ([^@]*) match?

a. [email protected]

b. [email protected]

c. 12345

d. [email protected]

3. Which of the follow regex patterns would match the alias string of [email protected]?

a. (.*)@company.com

b. (.{7})@company.com

c. d{3}@company.com

d. (.{6})@company.com

e. (.+)@company.com

4. Which of the following would match the regular expression pattern of (.*)(.)(.*)([0-9]{3}@comany.com?

a. [email protected]

b. [email protected]

c. [email protected]

d. [email protected]

5. Which of the following is the correct location of the Check Pattern Tool?

a. Maintenance > Tools > Check pattern

b. Status > Tools > Check pattern

c. Maintenance > Diagnostics > Check pattern

d. Status > Diagnostics > Check pattern

Foundation Topics

Overview and Use Cases for Regular Expressions

A regular expression, shortened as regex or also referred to as rational expression, is a sequence of symbols and characters expressing a string or pattern to be searched for within a longer piece of text. There are many software application and programming languages that support regular expressions (such as Python, Java, Oracle, etc.) and as usual in the software world, different regular expression engines are not fully compatible with each other. The Cisco Expressway uses POSIX format for regular expression syntax.

Images

Regular expressions can be used in conjunction with several Expressway features such as allow or deny lists for registration, subzone membership, alias transformations, zone transformations, CPL policy and ENUM. Table 4-2 provides a list of commonly used special characters in regular expression syntax. This is only a subset of the full range of expressions available.

Table 4-2 Regular Expressions

Images
Images

After understanding what regular expressions are and the syntax to utilize them, lets demonstrate some examples of regular expression manipulations that can exist on the Cisco Expressway:

Images Add domain to E.164 number

Images

Images Remove a domain

Images

Images Add a prefix to a numerical string

Images

Images Reverse the order of a string

Images

Images Match either [email protected] or [email protected]

Images

While we go into a few regular expression examples in this chapter, we will continue to utilize them later when discussing registration, subzone membership, alias transformations, and zone topics.

Verifying Regular Expression using the Check Pattern Tool

Use the Check pattern tool (Maintenance > Tools > Check pattern) lets you test whether a pattern or transform you intend to configure on the Expressway will have the expected result.

Patterns can be used when configuring:

Images Transforms to specify aliases to be transformed before any searches take place

Images Search rules to filter searches based on the alias being searched for, and to transform an alias before the search is sent to a zone

To use this tool:

Step 1. Enter an Alias against which you want to test the transform.

Step 2. In the Pattern section, enter the combination of Pattern type and Pattern behavior for the Pattern string being tested.

Images If you select a Pattern behavior of Replace, you also need to enter a Replace string.

Images If you select a Pattern behavior of Add prefix or Add suffix, you also need to enter an Additional text string to append/prepend to the Pattern string.

Images The Expressway has a set of predefined pattern matching variables that can be used to match against certain configuration elements.

Step 3. Click Check pattern to test whether the alias matches the pattern.

The Result section shows whether the alias matched the pattern, and displays the resulting alias (including the effect of any transform if appropriate).

Exam Preparation Tasks

As mentioned in the section “How to Use This Book” in the Introduction, you have a couple of choices for exam preparation: the exercises here, Chapter 22, “Final Preparation,” and the exam simulation questions in the Pearson Test Prep Software Online.

Review All Key Topics

Review the most important topics in this chapter, noted with the Key Topics icon in the outer margin of the page. Table 4-3 lists a reference of these key topics and the page numbers on which each is found.

Images

Table 4-3 Key Topics for Chapter 4

Images

Complete Tables and Lists from Memory

Print a copy of Appendix C, “Memory Tables” (found on the companion website), or at least the section for this chapter, and complete the tables and lists from memory. Appendix D, “Memory Tables Answer Key,” also on the companion website includes completed tables and lists to check your work.

Define Key Terms

Define the following key terms from this chapter and check your answers in the glossary:

Call Processing Language (CPL)

E.164 Number Mapping (ENUM)

Portable Operating System Interface (POSIX)

Regular expression

Q&A

The answers to these questions appear in Appendix A. For more practice with exam format questions, use the Pearson Test Prep Software Online.

1. Which regular expression strings would match the alias [email protected]?

Answers

1. This can be answered in multiple ways (which shows the power of expressions), but opens the question of how well you would like the resulting pattern to match the desired alias. Something as simple as .* would match, but would also match nothing and everything. Its suggested to match the alias closely to a structured dial plan to avoid matches when not desired and matches when desired.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.171.121