Re: repeated characters in SQL

Поиск
Список
Период
Сортировка
От Francisco Olarte
Тема Re: repeated characters in SQL
Дата
Msg-id CA+bJJbxKid0PMd7c=40DQ8rofW-rR52HeU0MUtD13Z8whkQ7=Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: repeated characters in SQL  (rashapoo@gmail.com)
Ответы Re: repeated characters in SQL  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Sun, Jan 24, 2016 at 7:05 PM,  <rashapoo@gmail.com> wrote:
> I guess the escape character (which is not needed in, say, Notepad++) threw
> me a bit.

Notepad ++ is, AFAIK,  an editor, it SHOULD (within reason) let you
write any text.

The double quote is needed due to the quoting rules of the language.
You want the regexp engine to see the characters leftp, dot, rightp,
backslash, one. But backslah is the scape character in strings ( in
many languages ), so you need to escape it too.

The same happens in, for example, C and Java. To put those five chars
in a string you need "(.)\\1". If you send "(.)\1" to a C compiler it
will build the string leftp, dot, rightp, SOH=(char)(1). It will
arrive to the backslash when parsing, see it is followed by a digit
less than 8, interpret it as an octal escape, and emit the SOH.

Francisco Olarte.


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

Предыдущее
От: rashapoo@gmail.com
Дата:
Сообщение: Re: repeated characters in SQL
Следующее
От: Tom Lane
Дата:
Сообщение: Re: repeated characters in SQL