I am writing an internal application where we let users to do a few different types of queries.
The application allows users to search a database by either of the following keys:
- employeeId
- name (first or last)
- companyId
- status (workingFullTime, sickLeave, maternityLeave, etc)
The brute force way is to simply make one webform for each type of query and have a menu where the user chooses which type of query to perform (this is ASP.NET)
But what I would like is to have a simple text box where the user enters the query and then the application should parse the query and automatically select the type of query to issue to the back end.
For example, the employeeId is a number of a precise format. So I can do a regular expression to match that. And the same is true for status, companyId, etc.
So my questions is if anyone here can give some advice on how to best code a method in C# that will take a string and match it against a number of different regular expressions.
Cheers, Joakim