The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
–1 vote

Which of the following strings would match the regular expression: p+[3-5]*[xyz]?

  1. p443y
  2. p6y
  3. 3xyz
  4. p35z
  5. p353535x
  6. ppp5
  1. I, III and Vl only
  2. IV, V and VI only
  3. II, IV and V only
  4. I, IV and V only
asked in Others by Active (3.9k points)
edited by | 1.4k views

1 Answer

+2 votes
Best answer

option 4.

p+[3-5]*[xyz] = p+(3+4+5)*(x+y+z)
Since, p has to be present as the first character of each string, 
I. p443y -> matched
Il. p6y -> not matched since 6 cannot used .
III. 3xyz  -> not matched Strings must start with p.
IV. p35z  -> matched
V. p353535x  -> matched
Vl. ppp5 -> not matched Strings must end with x, or y, or z.

answered by Active (3.9k points)
selected by

p+[3-5]*[xyz] = p+(3+4+5)*(x+y+z)  how?

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,047 questions
53,187 answers
70,394 users