I need to improve the search function on a page containing user accounts. Instead of having multiple search fields for each possible field or drop-down menu in which the user can search for only one field, I would like to use only one search block and use the gmail syntax. What is the best way I can describe this, and what I mean by gmail syntax, such as search syntax, you can enter the following in the input field:
username: bbaggins type: admin "made plc"
When the form is submitted, the search string should be divided into separate parts, which will allow me to build an SQL query. For example, type: admin will be part of the WHERE clause to find any entry where the field type is admin and the same for the username. Quoted text can be a free text search, but I'm not sure yet.
I think the correct expression or two will be the best way to do this, but this is what I'm really not very good at. Can someone help create a regex that can be used for this purpose? I searched around for some pointers, but either I donβt know what to look for or not because I couldnβt find anything obvious. Maybe if I understood the correct expressions better, it would be easier :-)
Greetings
Adam