Re: Regex Replace with 2 conditions

Поиск
Список
Период
Сортировка
От Francisco Olarte
Тема Re: Regex Replace with 2 conditions
Дата
Msg-id CA+bJJbyWvtWR5YfQ1w1oMCPU8MFb+HgK3HHtYpQ412127y9FOw@mail.gmail.com
обсуждение исходный текст
Ответ на RE: Regex Replace with 2 conditions  (Denisa Cirstescu <Denisa.Cirstescu@tangoe.com>)
Список pgsql-general
Denisa:

1.- Please, do not top-post, it makes seeing what you arereplying to difficult.

2.- Do not reply to several messages in one. Nobody reading this knows
my suggestions.

Having said that, regarding my part:

On Mon, Feb 5, 2018 at 5:54 PM, Denisa Cirstescu
<Denisa.Cirstescu@tangoe.com> wrote:
> I've tried the version that you are proposing before posting this question, but it is not good as it is removing
charactersthat have ASCII code greater than 255 and those are characters that I need to keep, such as "ă". 
>         SELECT regexp_replace(p_string, E'[^A-Za-z0-9%_]', '', 'g'));
> This is the request that I have: write a function that eliminates all ASCII characters from 1-255 that are not A-Z,
a-z,0-9, and special characters % and _ 

I repeat for the last time. YOU ARE NOT USING ASCII. ASCII IS A SEVEN
BIT CODE, 0-128. "ă" IS NOT IN THE ASCII CHARACTER SET.

Having said that I asked which character set you were using, you
didn't bother to answer. This is neccessary to know jow to express the
characters you want to preserve.

We could assume unicode, but from your examples it is not clear
whether you want to preserve all codepoints above 255 or just the
alphabetic ones. I suspect the later. The easier one can be, as I
suggested earlier, adding a range from codepoint 256 to the last one
in your regexp.

Anyway, RTFM. I suggest starting at
https://www.postgresql.org/docs/10/static/functions-matching.html#POSIX-BRACKET-EXPRESSIONS
and following on to see the many ways you have to expresss characters
in a regexp. Read carefully, as the documentation is rather dense, but
if you are not willing to answer simple questions like what is your
character set, or database encoding, it is the most I can do.

Francisco Olarte.

P.S. I have not commented on the rest of the message, directed to Tom,
but seeing you want something equivalent to the functionality of "tr
[-c] -d" I suspect lookahead/behind is overkill ( and from your
message I would assume well beyond your regexp skills ).

FO


В списке pgsql-general по дате отправления:

Предыдущее
От: Denisa Cirstescu
Дата:
Сообщение: RE: Regex Replace with 2 conditions
Следующее
От: Jeremy Finzel
Дата:
Сообщение: Alter table set logged hanging after writing out all WAL