This chapter covers the following topics:
Overview and Use Cases for Regular Expressions: This topic will explain as an overview of the use of regular expressions within the Cisco Expressway.
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:
1.7.d Describe Expressway Core dial plan elements - Regular expressions
2.2.d Configure Expressway Core dial plan elements - Regular expressions
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.”
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?
c. 12345
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?
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
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.
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.
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:
Add domain to E.164 number
Remove a domain
Add a prefix to a numerical string
Reverse the order of a string
Match either [email protected] or [email protected]
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.
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:
Transforms to specify aliases to be transformed before any searches take place
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.
If you select a Pattern behavior of Replace, you also need to enter a Replace string.
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.
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).
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 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.
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 the following key terms from this chapter and check your answers in the glossary:
Call Processing Language (CPL)
Portable Operating System Interface (POSIX)
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]?
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.
3.137.171.121