Re: [SQL] Regular Expression Match Operator escape character

2010-12-13 Thread Jasen Betts
On 2010-12-08, Gnanakumar wrote: > Hi, > > We're running PostgreSQL v8.2.3 on RHEL5. > > In some places in our application, we use Regular Expression Match Operator > (~* => Matches regular expression, case insensitive) inside WHERE criteria. > > Example: > SELECT ... > FROM ... > WHERE (SKILLS ~

[SQL] Regular Expression Match Operator escape character

2010-12-08 Thread Gnanakumar
Hi, We're running PostgreSQL v8.2.3 on RHEL5. In some places in our application, we use Regular Expression Match Operator (~* => Matches regular expression, case insensitive) inside WHERE criteria. Example: SELECT ... FROM ... WHERE (SKILLS ~* '(^|\\^|\\||[^0-9|^a-z|^A-Z]|$)C#(^|\\^|\\||[^0-9|^

[SQL] Regular Expression Data Type

2007-04-22 Thread Richard Doust
Hi. I appreciate that I can query the database and find records that match a regular expression. What I'd like to be able to do is to define a field in the database as a regular expression so that when I select, i.e., select price from shipping_prices where shipFromZip = '23773' and shipTo

Re: [SQL] Regular Expression in SQL

2006-07-15 Thread Tom Lane
"Aaron Bono" <[EMAIL PROTECTED]> writes: > I thought by using the FOR '#' I could specify exactly what part of the > expression I would get but it still grabs the first (...) of the pattern. Hmm ... I think that this is a bug in similar_escape(): it ought to transform parentheses in a SIMILAR patt

[SQL] Regular Expression in SQL

2006-07-15 Thread Aaron Bono
I recall not long ago a discussion about regular expressions in a query that hit on this exact topic but don't think it was ever resolved so I am giving it a go again...Here is my query (keep in mind that I am just experimenting now so don't worry about the fact that I am using nested substring fun

Re: [SQL] Regular Expression Matching problem...

2006-01-08 Thread Mario Splivalo
On Wed, 2006-01-04 at 10:00 -0700, Michael Fuhr wrote: > What Andreas is saying is that the patterns in the table have too > many backslashes. The original query was > > test=> select '+385911234567' ~ '^\\+38591\\d{7}$'; > ?column? > -- > t > (1 row) > > but if you select just the p

Re: [SQL] Regular Expression Matching problem...

2006-01-04 Thread Michael Fuhr
On Wed, Jan 04, 2006 at 03:50:31PM +0100, A. Kretschmer wrote: > Try this: > > test=# select '+385911234567', operator_phonenumber_pattern, '+385911234567' > ~ replace(operator_phonenumber_pattern,'','\\') from operators; >?column?| operator_phonenumber_pattern | ?column? > --

Re: [SQL] Regular Expression Matching problem...

2006-01-04 Thread A. Kretschmer
am 04.01.2006, um 15:08:45 +0100 mailte Mario Splivalo folgendes: > I have a table containing regular expresion patterns for matching phone > numbers with the mobile operators. > > For instance, my phone number is '+385911234567', and the regexp for > this mobile operator is: "^\+38591\d{7}$". >

[SQL] Regular Expression Matching problem...

2006-01-04 Thread Mario Splivalo
I have a table containing regular expresion patterns for matching phone numbers with the mobile operators. For instance, my phone number is '+385911234567', and the regexp for this mobile operator is: "^\+38591\d{7}$". Now, when I do a regexp match in a single select, it behaves as expected: oct

Re: [SQL] regular expression

2005-10-12 Thread Yasir Malik
This isn't a PostgreSQL issue, but rather one of understanding how regular expressions work in general. See the previously mentioned "Pattern Matching" section of the PostgreSQL documentation for the PostgreSQL-specific details, and use a search engine to find a regular expression tutorial; they'

Re: [SQL] regular expression

2005-10-12 Thread Michael Fuhr
[Please copy the mailing list on replies.] On Wed, Oct 12, 2005 at 04:28:47PM -0400, [EMAIL PROTECTED] wrote: > Thanks for the reply. It helped a lot. I was goint to ask similar question > regarding regular expression, but this time I need not the numeric part. What > I > mean is; > say that this

Re: [SQL] regular expression

2005-10-04 Thread Michael Fuhr
On Mon, Oct 03, 2005 at 06:08:30PM -0400, [EMAIL PROTECTED] wrote: > How do I do regular expression for the problem that I am having > I have a string called desc, and say that this string in > > "TSWUU" -- "" > "4 - DSC"-- "4" > "6768 - THY" -- "6768" > > basic

Re: [SQL] regular expression

2005-10-04 Thread Gnanavel S
Try this, select substring('6768 - THY','[0-9]*');  substring ---  6768 (1 row)On 10/4/05, [EMAIL PROTECTED] <[EMAIL PROTECTED] > wrote:How do I do regular _expression_ for the problem that I am havingI have a string called desc, and say that this string in "TSWUU"  -- """4 - DS

[SQL] regular expression

2005-10-04 Thread gurkan
How do I do regular expression for the problem that I am having I have a string called desc, and say that this string in "TSWUU" -- "" "4 - DSC"-- "4" "6768 - THY" -- "6768" basically string may or may not start with number, I need substring of digits parts ""

Re: [SQL] Regular expression problem

2003-10-24 Thread Jeff Eckermann
7.4 uses a completely new regex engine, so comparisons with that will not be valid anyway. Pre-7.4 regex behaviour is all documented: Users Guide -> Functions & Operators -> Pattern Matching --- "scott.marlowe" <[EMAIL PROTECTED]> wrote: > On 24 Oct 2003, Manuel Sugawara wrote: > > > Matias Surdi

Re: [SQL] Regular expression problem

2003-10-24 Thread scott.marlowe
On 24 Oct 2003, Manuel Sugawara wrote: > "scott.marlowe" <[EMAIL PROTECTED]> writes: > > > It certainly seems to work in Postgresql 7.4 beta 4: > > > > create table test2 (info text); > > CREATE TABLE > > insert into test2 values ('ab'); > > INSERT 109169538 1 > > insert into test2 values ('abc'

Re: [SQL] Regular expression problem

2003-10-24 Thread Manuel Sugawara
"scott.marlowe" <[EMAIL PROTECTED]> writes: > It certainly seems to work in Postgresql 7.4 beta 4: > > create table test2 (info text); > CREATE TABLE > insert into test2 values ('ab'); > INSERT 109169538 1 > insert into test2 values ('abc'); > INSERT 109169539 1 > > marl8412=# select * from test

Re: [SQL] Regular expression problem

2003-10-24 Thread scott.marlowe
On 24 Oct 2003, Manuel Sugawara wrote: > Matias Surdi <[EMAIL PROTECTED]> writes: > > > Manuel Sugawara wrote: > > >Use something like '^[a-z]{2}$' > > > > so, is this a bug > > No it is not. The sintax you are using is not supported. It certainly seems to work in Postgresql 7.4 beta 4: c

Re: [SQL] Regular expression problem

2003-10-24 Thread Manuel Sugawara
Matias Surdi <[EMAIL PROTECTED]> writes: > Manuel Sugawara wrote: > >Use something like '^[a-z]{2}$' > > so, is this a bug No it is not. The sintax you are using is not supported. Regards, Manuel. ---(end of broadcast)--- TIP 3: if posting/

Re: [SQL] Regular expression problem

2003-10-23 Thread Manuel Sugawara
Matias Surdi <[EMAIL PROTECTED]> writes: > Hi... I'm dealing with a regular expression in a check constraint for many > days i'm stuck with this... > > what I'm doing is adding a check to an existing table on a field called > codigoex1 (varchar(9) ) > > check (codigoex1 ~* '[a-z]{2,2}') > >

[SQL] Regular expression problem

2003-10-23 Thread Matias Surdi
Hi... I'm dealing with a regular expression in a check constraint for many days i'm stuck with this... what I'm doing is adding a check to an existing table on a field called codigoex1 (varchar(9) ) check (codigoex1 ~* '[a-z]{2,2}') and I can't get it to work! I want to validate only input d

Re: [SQL] Regular expression query

2000-10-15 Thread Bruce Momjian
> Rodger Donaldson <[EMAIL PROTECTED]> writes: > > SELECT url > > FROM sites > > WHERE url ~ url || '\\s+' > > > While this concatenation works with the LIKE directive (ie LIKE url || '%'), > > postgresql barfs on it in a regexp with the error: > > > ERROR: Unable to identify an operator '||'

Re: [SQL] Regular expression query

2000-08-28 Thread Oliver Seidel
> The regexp package we currently use implements POSIX 1003.2 regexps > (see src/backend/regex/re_format.7). I believe there is an item on the > TODO list about upgrading the regexp parser to something more modern > ... feel free to hop on that project if it's bugging you ... I would like to rec

Re: [SQL] Regular expression query

2000-08-24 Thread Tom Lane
Rodger Donaldson <[EMAIL PROTECTED]> writes: > SELECT url > FROM sites > WHERE url ~ url || '\\s+' > While this concatenation works with the LIKE directive (ie LIKE url || '%'), > postgresql barfs on it in a regexp with the error: > ERROR: Unable to identify an operator '||' for types 'bool' a

[SQL] Regular expression query

2000-08-24 Thread Rodger Donaldson
I have a large group of records which were entered with trailing garbage, in the form of superfluous \n. The main problem this has caused, other than the obvious one, is that the record in question is being used as a primary key, so some duplicates have slipped through. I assumed a simple state