PHP preg_match function always return false? -


I just started learning PHP days ago and got the hand with the preg_match () function I am wondering why the following always makes false?

  preg_match ('[AZ] {2}', 'CA')    

This is not a valid regular expression, you are missing the delimiter:

  preg_match ('/ [AG] {2} /', 'CA' )   

/ is a common delimiter but you want to use any limit (unless it is alphanumeric, not a backslash or whitespace ):

  preg_match ('@ [AZ] {2} @', 'ca') preg_match ('% [AZ] {2}%', 'ca')   

You also get a warning about missing delimiters Education will be notified. Turn on / off your error reporting level

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 -