php - Basic regexp help -
i new programming php , trying validate field in form.
the field if ral color code , : ral 1001. letters ral , 4 numbers.
can me set them regular expression validate them. have tried no success:
$string_exp = "/^[ral][0-9 .-]+$/i"; what can sorry being complete noob @ php.
cheers ben
[ral] match 1 character, either r, or l, whereas want match string "ral". want this,
$string_exp = "/^ral[0-9]{4}$/"; this match "ral1001", not "ral1","ral 1001", "ral12345", etc. if wanted space between ral , number, put space regexp.
Comments
Post a Comment