Hi Essa Alshaikh Ali and Sachin Marawar
As Essa said "Pattern" should be the best option for such use-case.
yesterday I designed this regex " ^(grant|revoke)\s+(SELECT|INSERT|UPDATE|DELETE|EXECUTE|REFERENCES|ALTER|CONTROL|TAKE OWNERSHIP|IMPERSONATE)(\s+(SELECT|INSERT|UPDATE|DELETE|EXECUTE|REFERENCES|ALTER|CONTROL|TAKE OWNERSHIP|IMPERSONATE))*(\s+\w+)+$"
and it's matching the queries like "grant select insert update on employee to moaz" or "grant delete on employee to moaz" or "revoke select insert update on employee from moaz"
I'm still trying to develop the regex to cover most queries options,
thanks a lot for your help Essa and Sachin,
Best regards,
------------------------------
Moaz Saadeldin
------------------------------