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
Tag: regex
SQL/Regex Challenge/Puzzle: How to remove comments from SQL code (by using SQL query)?
Requirements Single-lines comments (e.g. — my comment) should be removed. Multi-line comments (e.g. /* my comment */) should be removed. The content of strings literals (e.g. ‘this is a multi-line comment: /* my comment */’) should be ignored. The content of identifiers (e.g. “– column 1 –“) should be ignored. literals and identifiers Literals and identifiers can span over multiple
How to select sub string in oracle?
I have a scenario where my data is something like below: Chapter 18 Unit 10 Sect 16 Case 1 : I want to select Chapter 18 from the above string. Case 2 : I want to select Unit 10 from the above …
Oracle Regular Expression (REGEXP_LIKE) Too Long Error – ORA-12733
I have to validate an IPv6 address in PL/SQL. I came up with the regular expression from here: Regular Expression (RegEx) for IPv6 Separate from IPv4 I am getting an ORA-12733: regular expression too long error. Is there any way around this? The limit is 512 (https://stackoverflow.com/a/2694119/3112803), I’m at 657. I cannot think of any way to split this up.
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’ve gone about the wrong approach to the
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.8.9) this is a solution for
Regex remove all occurrences of multiple characters in a string
In my PostgreSQL I want to replace all characters (;) occurrences in a string. My query: update table_name set text = regexp_replace(text, ‘/[(;)]+/g’, ”); I think my regexp is …
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 code
Return sql rows where field contains ONLY non-alphanumeric characters
I need to find out how many rows in a particular field in my sql server table, contain ONLY non-alphanumeric characters. I’m thinking it’s a regular expression that I need along the lines of [^a-zA-Z0-9] but Im not sure of the exact syntax I need to return the rows if there are no valid alphanumeric chars in there. Answer SQL