ChallengeThe regex that doesn’t match

time to read 1 min | 173 words

Can you make this test pass?

var expected = @"Cached query: 
SELECT this_.Id             as Id5_0_,
       this_.Title          as Title5_0_,
       this_.Subtitle       as Subtitle5_0_,
       this_.AllowsComments as AllowsCo4_5_0_,
       this_.CreatedAt      as CreatedAt5_0_
FROM   Blogs this_
WHERE  this_.Title = 'The lazy blog' /* @p0 */
       and this_.Id = 1 /* @p1 */

Assert.True(Regex.IsMatch(expected, expected.Replace("5_", @"\d+_")));

I really don’t know what to think about this anymore….

More posts in "Challenge" series:

  1. (03 Jan 2020) Spot the bug in the stream–answer
  2. (15 Feb 2010) Where is the optimization?