From: | mike g <mike(at)thegodshalls(dot)com> |
---|---|
To: | btober(at)computer(dot)org |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: SUBSTRING for a regular expression |
Date: | 2004-07-06 03:24:21 |
Message-ID: | 1089084261.15115.26.camel@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
What language are you using for this plperl?
That command listed in the documentation certainly works in psql or
plpgsql but I don't know about plperl.
Are you assigning the result to a variable and then printing the result
of that variable before the function ends or printing based on what the
function returns?
I think you will probably need to show us the rest of the code in your
function.
On Mon, 2004-07-05 at 19:40, btober(at)computer(dot)org wrote:
> I can't seem to get right the regular expression for parsing data like
> these four sample rows (names and addresses changed to ficticious values)
> from a text-type column:
>
> Yolanda Harris, 38, of 40 South Main St., Newtown City, was charged
> Sunday with breach of peace and interfering with a police officer.
>
> Allen K. George, 30, of 88 Beverly Court was charged Saturday with
> possession of marijuana, third-degree criminal mischief, breach of peace,
> evading responsibility, interfering with a police officer, driving with a
> suspended license, driving under the influence of drugs or alcohol,
> failure to drive right and failure to have proper insurance.
>
> Brain T. Grafton, 18, of 97 Bristol Ave. was charged Sunday with
> possession of marijuana, possession of alcohol by a minor and failure to
> wear a seat belt.
>
> Brian D. Sptizer Jr., 18, of 20 Walling Ave., Northford, was charged
> Sunday with driving under the influence of drugs or alcohol, evading
> responsibility and following too closely.
>
> Into separate columns for: name, age, address, charge. For example the
> first record would have
>
> name='Yolanda Harris'
> age=38
> address='40 South Main St., Newtown City'
> charge='was charged Sunday with breach of peace and interfering with a
> police officer.'
>
> To get the name, for instance, I tried
>
> SELECT SUBSTRING(description FROM '^([:alnum:]*), \d{2}, .*$') FROM
> police_log;
>
> or the age value
>
> SELECT SUBSTRING(description FROM '^[:alnum:]*, (\d{2}), .*$') FROM
> police_log;
>
> But return values are all NULL. Can anyone give me some RE help, please?
>
> --Berend Tober
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match
From | Date | Subject | |
---|---|---|---|
Next Message | mike g | 2004-07-06 03:38:42 | Re: could not access file "$libdir/plpython" when |
Previous Message | Bruce Momjian | 2004-07-06 03:23:43 | Re: Multi-Language upper(),lower() |