« Return to Thread: Select statement compare only alpha characters

Select statement compare only alpha characters

by davidj2k :: Rate this Message:

Reply to Author | View in Thread

I am trying to make a select statement that compares the field to a value that is only alpha characters so here is the example
This is the value in the database:   $%ABC_abc-123(abc)
This is the value that I want to use to match that value:    abcabcabc

I tried using regexp_replace but it did not work the way I expected.  

select * from table where lower(regexp(fieldname, '[\d_\W]*', '')) = 'abcabcabc'

this regular expression works in C# but not in PostgreSQL

any suggestions

 « Return to Thread: Select statement compare only alpha characters