Meta interview question

Implement a very basic regular expression checker which given a string and a regex, returns true or false. Should consider 'a'-'z','.', and '*'.

Interview Answer

Anonymous

Oct 28, 2013

$regex = "/^[a-z\.\*]+$/"; $string = "something..."; return preg_match($regex, $string);