use "^" to search at the beginning
this pattern = starts with a number -- /^\d/ also works
Pattern --> /^[0-9]/
December 1 DOES NOT MATCH
1 December MATCH
February 22 DOES NOT MATCH
22 February MATCH

use "$" to search at the end
searches for filenames ending with *.jpg or *.JPG
note the letter "i" following the ending delimiter which makes the search case insensitive
Pattern --> /jpg$/i
file.txt DOES NOT MATCH
word.doc DOES NOT MATCH
photo.jpg MATCH
scotland.JPG MATCH

use "^xxx$" to tell PHP to find *only* "xxx"
searches for the word "man" by itself
Pattern --> /^man$/
man MATCH
woman DOES NOT MATCH
manual DOES NOT MATCH
romantic DOES NOT MATCH


<>