What is the regex to ensure a string is in below pattern
string::string with | as the separator if more than one.
For example:
1::String (ok)
1::James is a boy|2::Hello (ok)
1:James is a boy | 2:Hello (not ok - single column)
1:String , 2:Hellos (not ok - separator is a comma)
I tried the following code:
$pattern = '/\w::\w|/'; $string = "1::Strings|1::Strings"; preg_match($pattern , $string, $match);