0

I just take an exam with 15 questions. I answered smoothly to 11 of the 15 question, but now i have to answer 4 question about regex (in not my strong point).

So, first question:

Which of the following strings will be matched by the regex below?
$regex = '/^\d+[a-c]{2,4}$/';

a. ab12cd
b. 1234a
c. 12ab34
d. 1234abc
e. 1a2b3c

Second question:

Which of the following strings will be matched by the regex below? (choose two)
/^\d([a-i]|\d)\w+$/

a. 3x3
b. 12ab
c. 3hree
d. ab12cd
e. 1two3

Third question

Which of the following are true regarding the regex below? (choose two)
/^\d([a-z]+)\d{2}/

a. the reggex doesn't contain any subpatterns
b. subpattern number 1 is ([a-z]+)
c. subpattern number 0 is ([a-z]+)
d. the regex contains two subpatterns: ([a-z]+) and {2}
e. the regex contains one subpattern: ([a-z]+)

And the last one:

Which of the following are NOT true about the code section below? (choose two)
$regex = '/\d.[13]/';

a. the [13] character class will match the number 13
b. the [13] character class will match either 1 and 3
c. the regex matches strings that have a lenght of 13 characters
d. \d is a character class that indicates a digit
e. the regexx matches strings that contain only digits

Is the final exam and i have one last chance. Please help me!

Juan
  • 1

0 Answers0