6 kyu

Regex for a decimal number divisible by 4

384 of 419kolichj

Description:

Your task is to write a regular expression that matches positive decimal integers divisible by 4. Negative numbers should be rejected, but leading zeroes are permitted.

Random tests can consist of numbers, ascii letters, some puctuation and brackets. But no need to check for line breaks (\n) and non-ASCII chatracters, nothing that fancy in the tests.

There is 50 characters limit for this regex to avoid hardcoding and keep the "puzzle" status :) Good luck!

Regular Expressions
Puzzles

More By Author:

Check out these other kata created by kolichj

Stats:

CreatedNov 22, 2018
PublishedNov 22, 2018
Warriors Trained999
Total Skips14
Total Code Submissions3552
Total Times Completed419
Python Completions384
Ruby Completions55
Total Stars19
% of votes with a positive feedback rating91% of 116
Total "Very Satisfied" Votes99
Total "Somewhat Satisfied" Votes12
Total "Not Satisfied" Votes5
Total Rank Assessments5
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • kolichj Avatar
  • anter69 Avatar
  • Blind4Basics Avatar
  • FArekkusu Avatar
  • Just4FunCoder Avatar
Ad