Tuesday, 27 August 2013

Regex to only let two words: either male or female

Regex to only let two words: either male or female

I need to let through into SQL query only two words: either male or female
I use PHP function that returns:
return preg_replace( "/([male|female])/i", '', $data );
At the moment it removes these words but how do I delete absolutely
everything and let only
either male or female?
What am I missing here?

No comments:

Post a Comment