REGEX quiz

Hi guys,please help identify the solution.

Thanks in advance

@Latifa

option C

after +40- you need all the digits means this will be right

cheers

Hi @Latifa

The answer would be option D

Regards,

There are many hints that C is not the answer

@Latifa you can learn and prototype also directly like:

@Latifa

except option A all are correct

if you want to get the digits after +40

then Option D is perfect

@Anil_G @postwick @mkankatala your opinion with explanation for my understanding please

Sorry, I have no clue what they’re even asking here or what their screenshots are. It makes no sense to use RegEx for this.

@postwick The question is;
How should the regular expression be configured in the RegEx Builder to match only phone numbers starting with +40 in the format shown above?

I don’t know, I tried all of their choices and none of them actually work.

This is RegEx that actually works, of course it isn’t one of their choices.

[+40]*[-\d]*

1 Like

No, as from the classes it can also match +04 and digit blocks which are different
grafik

@Latifa
We gave you a hint on

  • how to check in the matches what each options will do
  • using Regex101 to get explanations on patterns

when the phonenumber in the format starting with +40 and then with three blocks of -XXX (X=Digit) is to match

then you will find 1 option where all contstraints are reflected. Some cheaters:

  • look at the hypen (-)
  • look at the pattern which gives you a -XXX Block
1 Like

I edited it. Look again.

However, I actually tried all of their four options and none of them worked.

Why are you asking these type of questions?

@ppr thanks for this. I am watching some videos here on regex grouping and option D comes close. I am not sure if I got it right.Am still a newbie and appreciate your challenge

Hey @Latifa

Be sure to check out my Regex MegaPost which may help you :blush:

Cheers

Steve

@Steven_McKeering checking it right away. Thanks for sharing