Skip to content

Tag: regex

Using ‘LIKE’ and ‘REGEXP’ in a SQL query

I’m trying to use some regex on an expression where I have two conditions on the WHERE clause. The pattern I want to capture is 106 followed by any digit followed by a digit that must be either 3 or 4, i.e. 106[0-9][3-4] First, I tried this: This produced an error as below and it would be good to know

Access UPDATE query using Regular Expressions

I have created the following Regular expression in javascript to test if the string works. which works perfectly fine. However no i have tried to convert this SQL (using the ms access sample database) i have tried the following which hasn’t worked as i get an error. which didn’t work. I think I&#8…

Replace Parameters in SQL query text with XXXXX

I m writing a small utility that captures and logs SQL statements, but will have to remove sensitive data from the Query text and replace with with some dummy text (i.e:XXXXX). What is a good way to parse the SQL query in java and replace parameters value? for example: replace with Answer Using JSQLParser (V0…

Extract SQL statements from Java/SQL files

I have a huge codebase that has a lot of JAVA and .sql files. I intend to extract all the SQL statements from all these files. Here is the way I intend to achieve this – Build a regex file containing patterns like select, insert, delete, update etc that I intend to extract. Parse files line by line in c…