in reply to Re: Regex Validation
in thread Regex Validation

My thought was "the same, but backwards": since everything seems OK except a group of either one or three or more colons (delimited by non-colons), look for that pattern and reject if found.
>perl -wMstrict -le "my $invalid = qr{ (?<! :) (?: : | :{3,}) (?! :) }xms; print '------ output ------'; for my $s (@ARGV) { print $s =~ $invalid ? 'NO' : 'OK', qq{ '$s'}; } " "sip:userid@example.com" "sip::userid@example status::code" "::" "::a::" ":::bad_example::" ":" ":::" "::::" ------ output ------ NO 'sip:userid@example.com' OK 'sip::userid@example status::code' OK '::' OK '::a::' NO ':::bad_example::' NO ':' NO ':::' NO '::::'