Re: [SQL] Removing whitespace using regexp_replace

2007-10-28 Thread Thomas Kellerer
Andreas Kretschmer wrote on 28.10.2007 13:32: But it seems my problem was actually caused by something else: SELECT regexp_replace(myfield, '\s*', '', 'g') FROM mytable; you should escape the \, change to ...'\\s*'... Ah! Didn't think this was necessary, as \t or \n did not need to be escaped

Re: [SQL] Removing whitespace using regexp_replace

2007-10-28 Thread Andreas Kretschmer
Thomas Kellerer <[EMAIL PROTECTED]> schrieb: > Andreas Kretschmer wrote on 28.10.2007 12:42: > >>I have a column with the datatype "text" that may contain leading > >>whitespace (tabs, spaces newlines, ...) and I would like to remove them > >>all (ideally leading and trailing). > >You can use tr

Re: [SQL] Removing whitespace using regexp_replace

2007-10-28 Thread Thomas Kellerer
Andreas Kretschmer wrote on 28.10.2007 12:42: I have a column with the datatype "text" that may contain leading whitespace (tabs, spaces newlines, ...) and I would like to remove them all (ideally leading and trailing). You can use trim() for that: select 'x' || trim(both '\t' from trim(both

Re: [SQL] Removing whitespace using regexp_replace

2007-10-28 Thread Andreas Kretschmer
Thomas Kellerer <[EMAIL PROTECTED]> schrieb: > Hi, > > I have a column with the datatype "text" that may contain leading > whitespace (tabs, spaces newlines, ...) and I would like to remove them all > (ideally leading and trailing). You can use trim() for that: select 'x' || trim(both '\t' fr

[SQL] Removing whitespace using regexp_replace

2007-10-28 Thread Thomas Kellerer
Hi, I have a column with the datatype "text" that may contain leading whitespace (tabs, spaces newlines, ...) and I would like to remove them all (ideally leading and trailing). I tried SELECT regexp_replace(myfield, '\A\s*', '') FROM mytable; (for leading whitespace, to start with) But it