I want to validate a color input field. I want to check whether input value is hex color or not using regex pattern.
'icon_color' => 'required|regex:^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$',
This is the rule I've made but it gives following error.
preg_match(): No ending delimiter '/' found
Could someone tell what I am doing wrong. Suggestions are appreciated.