I am making a mini-parser of sql to estimate the maximum length of the value that an operation or a function will return. Ex: round (column, 2). For that, I am using regular expressions. For the example I gave, I got the regular expression round\((\w+)(,\s*(\d+))?\)
.
However, I came across these cases
column1||column2||column3||... columnn
concat(column1, column2, ... columnn)
I tried for the first case (although I knew it wouldn't work), with regex like:
(\w+\|\|\w+)+
(\w+\|\|\w+\|\|)|(\|\|\w+\|\|\w+)
What regex do you propose to match the above cases? Or rather a more general question: How could I know if n strings are joined with a specific string?