sql - Change syntax using regular expression -


I have some legacy language code snippets that are stored in the database tables that I need to convert to a syntax such as SQL so that It is

F, P: Q]

either to indicate the values ​​of different commas or a limit of colon-delimited values

I'll call it equivalent to the SQL-friendly snippet (A, B, C) or between X and Y or keywords

  will be in the search between keywords (D, E, F) or P and Q.  

thanks

This is not regex, but firstly it seems to remove it Then divide the columns with

  textVariable = a, b, c, x: y, d, e, f, p: q  

So that you have an array where each element is part of the string. Then your resulting array

  array [0] = a ... array [3] = x: y ...  

let's move your array again And create the final string you want. (As it has not been tested)

  finalString = "" tempString = "" (int i = 0, i & lt; array.length; i ++) {if ("[:]]" (":")} {// then it needs to be between two values ​​if (last string.log> 0) {final string = last string + "or"; // to add a 'or'} if (tempString.length & gt; 0) {// final string = last string = tempestring + "} or"; } Temparray = array [i] .split (":") Last string = Last string + "between" + temparray [0] + "and" + temparray [1]} and "{if (tempString.length = 0) {TempString = "Keyword ("; // is required to start the next set) Other {tempString = tempString + ","} tempString = tempString + array [i];}}  
< / Div>

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -