Exam UiARD All QuestionsBrowse all questions from this exam
Question 228

A developer wants to extract data using regular expressions from a String variable. The variable has the following format: . The information that needs to be extracted is the , only if the prefix is +40. The phone number is written in the format: +XX-XXX-XXX-XXX, where X can be any digit (e.g., +40-099-999-999).

How should the regular expression be configured in the RegEx Builder to match only phone numbers starting with +40 in the format shown above?

    Correct Answer: D

    To match phone numbers starting with +40 in the given format, the regular expression should capture the exact structure of the phone number including the literal characters and digit patterns. The correct regex pattern in this case is: \+40(-\d{3}){3}. This captures: the literal +40 prefix, followed by three groups of exactly three digits each separated by hyphens. Hence, the correct configuration is shown in option D.

Discussion
Engineer24Option: D

D is the correct answer, Tested in Studio !

sur_bhi123456789Option: D

according to me D should be the ans.