php - preg_match pattern check that strin contain only letters,whitespace and dot -


An easy way to check the code below shows that the name field only includes letters and white space if If the value of the Name field is not valid, archive an error message:

  $ name = test_input ($ _ POST ["name"]); If (! Preg_match ("/ ^ [a-zA-Z] * $ /", $ name)) {$ nameErr = "letters and white space allowed only"; }   

My question is how can I add dot (.) here?

Exchange this line:

  if (! Preg_match (" / ^ [a-zA-Z] * $ / ", $ name))    
  if (! preg_match (" / ^ [a-zA-z \. * * $ / ", $ Name])   

To avoid the character of . , as it has a special meaning in its regular meaning.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -