nerdexam
Cisco

300-815 · Question #91

Refer to the exhibit. Which change to the translation rule is needed to strip only the leading 9 from the digit string 91234548?

The correct answer is A. rule 1 /^9(.*)/ /\1/. The translation rule 'rule 1 /^9(.)/ /\1/' uses a regular expression to match and transform the digit string. The pattern '/^9(.)/' works as follows: '^9' anchors the match to the beginning of the string and matches the literal digit 9 only when it is the first character; '(.*)'

Session Border Controller and Voice Gateway Technologies

Question

Refer to the exhibit. Which change to the translation rule is needed to strip only the leading 9 from the digit string 91234548?

Options

  • Arule 1 /^9(.*)/ /\1/

How the community answered

(26 responses)
  • A
    100% (26)

Explanation

The translation rule 'rule 1 /^9(.)/ /\1/' uses a regular expression to match and transform the digit string. The pattern '/^9(.)/' works as follows: '^9' anchors the match to the beginning of the string and matches the literal digit 9 only when it is the first character; '(.*)' is a capture group that matches all remaining characters after the leading 9. The replacement '/\1/' substitutes the entire matched string with only the contents of capture group 1 - the digits after the leading 9. Applied to '91234548', the regex matches '9' at the start and captures '1234548'. The result is '1234548', with only the leading 9 stripped. The '^' anchor is critical - without it, a 9 appearing anywhere in the string (not just at the start) could be stripped.

Topics

#Translation Rules#Regular Expressions#Digit Manipulation#Cisco IOS Voice Gateway

Community Discussion

No community discussion yet for this question.

Full 300-815 Practice