Regex escape [ character and change text result into integer

From: David Pratt <fairwinds(at)eastlink(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: Regex escape [ character and change text result into integer
Date: 2005-07-05 16:01:41
Message-ID: 135FD6F4-ED6E-11D9-A19D-000A27B3B070@eastlink.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi. I am using array_dims to give me dimensions of multidimensional
array ie:

[1:5][1:2]

In my function I want to retreive the value of the second number from
array_dims (5 in example above)

This is what I am trying:

count_str = substr(dimensions from '\[\d\:(\d+)\]\[\d\:\d\]')
(this should give me 5 in the above example)

I have two problems:

1) I can't seem to escape the [ character - so how do I do this?
2) How do I turn my result which is originally text into an integer?

Regards,
David

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-07-05 16:22:57 Re: Regex escape [ character and change text result into integer
Previous Message Greg Stark 2005-07-05 15:56:14 Re: How can this be optimized, if possible?