December 19th, 2013, 03:57 AM
Get words from regex data
i have column in a data base which has a reg expression data. i want to evaluate the expression and get out of the data. Here is an example, in the below values just need to retrieve only (a,b,c). remaning we can ignore
"((x.y.z == "a") OR (y.x.z intersects "b,c"))"
i am using posgres version :9.2
December 19th, 2013, 07:41 AM
Do you really want to evaluate
"((x.y.z == "a") OR (y.x.z intersects "b,c"))""
or do you want to replace x.y.z with a value from a record?
And of course: why do you have regular expressions instead of SQL statements?
December 19th, 2013, 07:47 AM
1. i don't want to replace records to x.y.z, just need a value from the expression which is in Quotes.
2.if there is sql statement option let me know.
December 19th, 2013, 07:57 AM
The problem is that regular expressions are always applied to a string, they are not mathematical equations like "1+2=a" where the output is somehow a=3. Also, the keyword OR and INTERSECT don't exist in regular expressions (at least not for PostgreSQL)
So, what are you working on, where do these expressions come from?
December 19th, 2013, 08:02 AM
these expression comes from another table.we are fetching the columns and formatting the data to load into another table.
Originally Posted by Vinny42
December 19th, 2013, 08:10 AM
But this expression, if postgreSQL can evaluate it, will just return false, always. "x.y.z" is not equal to "a" and it has nothing in common with "b,c".
So perhaps you need to do a bit more explaining about how you think this is supposed to work :-)