hsbsitez
01-03-2009, 05:29 PM
I use 2 regular expressions to do the following:
User enters: genre:comedy type:direct hello
The script removes genre and type switch, so it becomes: hello
There isn't a specified order in which the switches have to occur. Also, a user can expand the genre switch to something like(separated by commas or semi-colons): genre:comedy;action;
I use following expressions:
$key = preg_replace('/genre:([a-zA-Z\,\;]*)/', '', $key);
$key = preg_replace('/type:([a-zA-Z\,\;]*)/', '', $key);How can I combine the two patterns into one?
User enters: genre:comedy type:direct hello
The script removes genre and type switch, so it becomes: hello
There isn't a specified order in which the switches have to occur. Also, a user can expand the genre switch to something like(separated by commas or semi-colons): genre:comedy;action;
I use following expressions:
$key = preg_replace('/genre:([a-zA-Z\,\;]*)/', '', $key);
$key = preg_replace('/type:([a-zA-Z\,\;]*)/', '', $key);How can I combine the two patterns into one?
