I need to detect if a colon :
is in a string. How can I match or negatively match a colon using regular expressions with preg_match
?
In my case I need to negatively match as there must not be a colon in order to do something:
if(! preg_match("/(:)+/",$strdomaine)) {
// If no colon found do something
}
else {
// colon found
}
I have tried various regex versions but cannot seem to do it. I have read that the the colon is special, could be a delimiter, etc.
Does this mean there is a special way to detect the colon?
add a comment