i’m working on a php script that is called by frontlinesms and I have set a grammar.
the grammar would be
<phrase> @ <phrase>
<phrase> = are a series of words composed of [a-zA-Z0-9]
and @ occurs only once, and should be between the two
i can’t seem to work this out. here’s my initial code:
preg_match_all("/(^[a-zA-Z0-9])@([a-zA-Z0-9])$/", $message_content, $matches, PREG_OFFSET_CAPTURE);
print_r($matches);
$message_content
contains the string
Edit: What I want to do here is to check whether the input string stored in $message_content follows the rules of the given grammar which is @ .
I just want a return of true or false while print_r($matches) outputs Array().
try this