- https://www.codewars.com/kata/5269452810342858ec000951 Coordinates Validator.
Started at 15:14 11.09.2020 Friday Sep.
Finished at 15:29 11.09.2020 Friday Sep. (0hrs 16minutes)
<?php | |
# https://www.codewars.com/kata/5269452810342858ec000951 Coordinates Validator. | |
function isValidCoordinates($coordinates) { | |
$c = $coordinates; | |
echo "Input: $c\n;"; | |
$ans = preg_match('/^-?(\d|([0-8]\d)|(90))(\.\d{1,8})?, -?(\d|(\d\d)|(0\d\d)|(1[0-7]\d)|(180))(\.\d{1,8})?$/',$c); | |
return (bool) $ans; | |
} |
Started at 15:14 11.09.2020 Friday Sep.
Finished at 15:29 11.09.2020 Friday Sep. (0hrs 16minutes)
About rubs33 and chrisom solutions.
From this example I got some information about PHP Backreference to the named subpatterns in Regex, Perl Compatible Regular Expression if more precisely.
Thank you.