-1

I believe my validation is correct however it is not working.

My regular expression pattern is

ValidationExpression= "(I|II|III|IV)[DEF]?" 

Basically, the user should put any of the first options then with optional D, E or F

Valid text Example: IIIC Thank you

Sam
  • 61
  • 10
  • No. It is basically I or II or III or IV with optional letter DEF. that's the only allowed patterns the above question is different. Allowed Examples. ID, IE, IF, IID, IIE, IIF, IIID, IIIE, IIIF, IVD, IVE, IVF – Sam Aug 01 '17 at 16:08
  • [Look here, `^(I|II|III|IV)[DEF]?$` does exactly what you need.](https://regex101.com/r/1V5Gcp/1) Just add `^` and `$`. – Wiktor Stribiżew Aug 01 '17 at 16:16
  • Wiktor, your right. Many Thanks! – Sam Aug 02 '17 at 08:37
  • I just don't understand why some people vote down others questions! I mean what you gonna gain out of it?! if things are obvious to you perhaps you could be more considerate and realise we are all in different levels, I did not see the above question as duplicate, I mean seriously if i would find a useful answer to my question why bother asking in first place, the reason I published a question shows I didnt find answer. and also clearly from my question you can see I was nearly there which means I worked hard and read about it to be that close! – Sam Aug 02 '17 at 16:08

1 Answers1

1

I don't know much about regex, but I did a quick bit of googling and came up with this:

https://regex101.com/r/KYpVbk/1

It explains how it works at the side :)

Sasha
  • 1,674
  • 1
  • 16
  • 23
  • I voted your answer up coz the tool you've provided is very useful! Thank you :) – Sam Aug 02 '17 at 08:37
  • @Sam no problem, If this is the correct answer you can select it as the correct answer to your question :) – Sasha Aug 02 '17 at 15:00