I am trying to search for a string that contains either a \ or / or a | character stored in column of a table.
so for an example:
I have a table called medication .
lets say the column of this medication table is brand
the brand table has some string values like:
abcef\ang\el
mghi/profe|ssional
bb/er|sup/er
i want to search for any record in the medication table that has either a \, /, or a | Character. As you can see there can be numerous occurences of these characters
If there is a match then I need to return the entire record.
Can anyone help and suggest if he following is correct or show a better way. Please note I plan to use regex as this is big table, and I am going this table with other tables as well.
this is what i did:
select m.brand
from medication m
where m.brand ~ '.*[\|\\\/].*'
I was trying to use regex_matches also but did not have any luck using it in where clause
also I tried this
select regex_matches(m.brand,'.*[\\\|\/].*',) from medication m
but i get kernel errors
any help would be appreciated
thanks jay
where m.brand ~ '.*[\|\\\/].*'looks like it would work, what went wrong when you tried?