Domanda di colloquio di Meta

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

Risposta di colloquio

Anonimo

28 ott 2013

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