Re: repeated characters in SQL - Mailing list pgsql-general

From Francisco Olarte
Subject Re: repeated characters in SQL
Date
Msg-id CA+bJJbxKid0PMd7c=40DQ8rofW-rR52HeU0MUtD13Z8whkQ7=Q@mail.gmail.com
Whole thread Raw
In response to Re: repeated characters in SQL  (rashapoo@gmail.com)
Responses Re: repeated characters in SQL  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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 by date:

Previous
From: rashapoo@gmail.com
Date:
Subject: Re: repeated characters in SQL
Next
From: Tom Lane
Date:
Subject: Re: repeated characters in SQL