473,387 Members | 1,515 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Migrating between versions. Problem with regexp

Dear friends,

I have the following problem.

libvar=# select version();
version
----------------------------------------------------------------
PostgreSQL 7.2.3 on i386-pc-bsdi4.0.1, compiled by GCC 2.7.2.1
(1 row)

libvar=# select '\\a\\à\\à\\.' ~ '\\a\\à\\à\\.';
?column?
----------
f
(1 row)
=======================================

libvar=# select version();

version
--------------------------------------------------------------------------------------------------------------
PostgreSQL 8.0.0beta1 on i686-pc-linux-gnu, compiled by GCC gcc (GCC)
3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)
(1 row)

libvar=# select '\\a\\à\\à\\.' ~ '\\a\\à\\à\\.';
ERROR: invalid regular expression: invalid escape \ sequence

I am using:
This is perl, v5.6.0 built for i386-bsdos
When I receive a text from CGI I made quotemeta over it to avoid symbols
that may be met in regular expressions.
Then I made DBI->quote over the same string to avoid any sql injection;
The problem is that I use cyrillic and quotemeta put before every
cyrillic character a \.
Then DBI->quote make \ to \\.
And then when I use this string in regular expression in Postgres I
recevie an error in the new version of postgres.
Could anyone sugest solution to my problem.
10x in advance.
Kaloyan

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #1
4 1715
Kaloyan Iliev Iliev <ne***@faith.digsys.bg> writes:
libvar=# select '\\a\\à\\à\\.' ~ '\\a\\à\\à\\.';
ERROR: invalid regular expression: invalid escape \ sequence


7.4 and later are stricter about the use of \ than prior versions; see
http://www.postgresql.org/docs/7.4/s...CAPE-SEQUENCES
You could go back to (approximately) the old behavior by changing
regex_flavor to "extended".

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #2
Thank you
Kaloyan

Tom Lane wrote:
Kaloyan Iliev Iliev <ne***@faith.digsys.bg> writes:

libvar=# select '\\a\\à\\à\\.' ~ '\\a\\à\\à\\.';
ERROR: invalid regular expression: invalid escape \ sequence


7.4 and later are stricter about the use of \ than prior versions; see
http://www.postgresql.org/docs/7.4/s...CAPE-SEQUENCES
You could go back to (approximately) the old behavior by changing
regex_flavor to "extended".

regards, tom lane


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #3
Dear Tom Lane,
I still haven't read all the documentation but I find the following.
If I escape with \\ latin letters it OK, but if escape with \\
cyrillic letters then it is a mistake.

libvar=# select '\\a\ÿ' ~* '\\a\ÿ';
?column?
----------
f
(1 row)

libvar=# select '\\a\\ÿ' ~* '\\a\\ÿ';
ERROR: invalid regular expression: invalid escape \ sequence
libvar=# select '\\a\\ÿ' ~* '\\a\ÿ';
?column?
----------
f
(1 row)

libvar=# select '\\a\ÿ' ~* '\\a\\ÿ';
ERROR: invalid regular expression: invalid escape \ sequence

So I understand that you can't adapt it to all languages and alphabets
but in case this is an error and can be fixed I report it.
Kaloyan

Tom Lane wrote:
Kaloyan Iliev Iliev <ne***@faith.digsys.bg> writes:

libvar=# select '\\a\\à\\à\\.' ~ '\\a\\à\\à\\.';
ERROR: invalid regular expression: invalid escape \ sequence


7.4 and later are stricter about the use of \ than prior versions; see
http://www.postgresql.org/docs/7.4/s...CAPE-SEQUENCES
You could go back to (approximately) the old behavior by changing
regex_flavor to "extended".

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend



---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #4
Kaloyan Iliev Iliev <ne***@faith.digsys.bg> writes:
I still haven't read all the documentation but I find the following.
If I escape with \\ latin letters it OK, but if escape with \\
cyrillic letters then it is a mistake.


No, you're missing the point: there are certain escapes that mean
something, and it rejects the rest. Backslash is not a general-purpose
quoting character.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tom Loredo | last post by:
Hi folks- I'm about to move from a Solaris 8/SPARC environment to a Dell running RedHat 9. Are there any issues I need to be aware of in bringing my Python code over (mostly scientific...
10
by: Markus Enders | last post by:
Hi everybody, currently we use DB2 7.1 on several Solaris machines. Now we are planning, to migrate to SUSE Linux (newest version). I wonder, if we can keep our DB2 version 7.1, or if we need to...
2
by: Cam Chapman | last post by:
Does anyone have any experience migrating a DB2 database off UDB 6.1 (Solaris) to 7.2 (Linux)? The database does not already exist on the Linux box. Have created a DB2 instance fine. DB2...
4
by: Jon Maz | last post by:
Hi All, I want to strip the accents off characters in a string so that, for example, the (Spanish) word "práctico" comes out as "practico" - but ignoring case, so that "PRÁCTICO" comes out as...
4
by: Collin Peters | last post by:
I have searched the Internet... but haven't found much relating to this. I am wondering on what the best practices are for migrating a developmemnt database to a release database. Here is the...
6
by: guy | last post by:
When migrating VB2003 source code to VB2005 are there any breaking changes? I can only find info that refers to different versions of the framework, and which is not what im looking for. cheers ...
4
by: =?Utf-8?B?QXJqdW4=?= | last post by:
Hi, After migrating my application from VC++ 6.0 to VC++ 2005, I receive the error C2593 'operator +=' is ambiguous. It refers to the following line: Name += pManager->GetAgentName(); ...
4
by: Matt | last post by:
Hello all, I have just discovered (the long way) that using a RegExp object with the 'global' flag set produces inconsistent results when its test() method is executed. I realize that 'global'...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.