I am a little lost with preg_match.
I am tring to match only the first letter of a string... ie
$var = "John Smith"; if (preg_match("/J/", $var)){ echo "yes there is a match"; } else{ echo "no match"; }
the above is wrong so any help would be great.
You need to use the start-of-string assertion "":
if(preg_match('/^J/', $var)) {
Thanks, i have started to read more about this complex regex syntax