attempting to implement regexp matching