IT Questions and Answers :)

Wednesday, November 22, 2017

Which .NET RegEx pattern does NOT match the string "Tales from SpiceWorks!"?

Which .NET RegEx pattern does NOT match the string "Tales from SpiceWorks!"?

  • '^\w*\ \w* \w*\W$'
  • '^(?x)\w{5} \w{4} \w{10}!$'
  • '^[^bunz]*$'
  • '^(?:\w{4,10}\s?){3}\W$' 
Which .NET RegEx pattern does NOT match the string "Tales from SpiceWorks!"?

 EXPLANATION

'^(?x)\w{5} \w{4} \w{10}!$' does not match because it uses the RegEx option "x", which ignores unescaped white space; if you replaced the white space with "\s" or removed the "(?x)" option, it would work.


Share:

Popular Posts

Blog Archive