Hi,
Did not expect pattern expression design to be so exhausting but had to get away from ereg due to speed concern. When I study the 30 min tutorial, my hats off to the experts even though I did a course in spitbol. The complexity is amazing.
Validate name being alphabetic with [- ' '] (minus for join name eg Van-Dame, quote for O'Reilly.
$pattern = '/[A-Za-z.]+[-\'A-Za-z]+[A-Za-z]+{2,15}/';
{starting alpha or period]one or more
[join or quote or alpha] one or more
[name ends with alpha]
(2,15) name length between 2 to 15 characters.
Online input form to stop most mischief. Would like to handle names with circumflex or vowels with accent in languages like German, French, etc. Suggestion please.
Validate address. Since street uses name, we accept the name pattern. Worldwide address can be "Red church at corner" or 6th-7th Ave. So I be nice and allow some mischief like period ending for St.
$patternaddr = '/[0-9A-Za-z]+[- .\"0-9A-Za-z]+(4,22)/'
Address starts alphanumeric (one or more)
Join, period, or quote or alphanumeric (one or more)
If preg_match($pattern, $name)
{tx for your help}
First time coding in PHP and thought I had it in the bag with erag but discover perfomance and just did read at php net manual, google for greg name and address ( tons of email address, needle in haystack) .
Other point, Can one input field accept any foreign language or most of what languages?. Input stored in sql , retrieve, and echo in html. What steps to protect and issue for chinese(2bytes for chinese, japanese charaters)?
Tx again and hope this puzzle is not too complicated. Surprise I could not find these common pattern checks. Defining Object method in php error checking. One liners pattern and length matching, generalized. That is why I am force to solve this puzzle.