Re: [GENERAL] back references using regex

2005-09-11 Thread Michael Fuhr
On Sun, Sep 11, 2005 at 12:30:59AM -0700, Matthew Peter wrote: > Speaking of data manipulation in a table... I was > thinking about storing and manipulating a list in a > column... Please ask new questions in a new thread with a Subject header related to the new topic. People who might be intere

Re: [GENERAL] back references using regex

2005-09-11 Thread Matthew Peter
How about this then, I didn't retain that information from the doc. ;) I sometimes glaze over important gems every now and then. It happens. I'm not a robot, yet. At least I know the answer to my question is now retained. You were a big help too. Thank you very much. I appreciate it. Speaking of

Re: [GENERAL] back references using regex

2005-09-10 Thread Michael Fuhr
On Sat, Sep 10, 2005 at 10:27:13AM -0700, Matthew Peter wrote: > ah I swear I never came across any of these > gems of information in the docs. It was these subtle > differences that were throwing me. >From "Regular Expression Escapes" in the "Pattern Matching" section of the manual: A

Re: [GENERAL] back references using regex

2005-09-10 Thread Matthew Peter
ah I swear I never came across any of these gems of information in the docs. It was these subtle differences that were throwing me. I didn't originally catch that regex's were based on grep/sed/awk syntax which I haven't studied throughly yet. I've only used some basic operations in bash

Re: [GENERAL] back references using regex

2005-09-10 Thread Michael Fuhr
On Fri, Sep 09, 2005 at 10:11:46PM -0700, Matthew Peter wrote: > One other thing, when I wrote back I actually used > 34.31.29.20 (random), not 12.00.00.34 like i showed in > the example, which is why i said it didn't work on > digits. When posting examples, please post something you actually trie

Re: [GENERAL] back references using regex

2005-09-10 Thread Douglas McNaught
Matthew Peter <[EMAIL PROTECTED]> writes: > One other thing, when I wrote back I actually used > 34.31.29.20 (random), not 12.00.00.34 like i showed in > the example, which is why i said it didn't work on > digits. > > SELECT substring('34.31.29.20' FROM $$((\w+)\.\2)$$); > substring > ---

Re: [GENERAL] back references using regex

2005-09-09 Thread Matthew Peter
One other thing, when I wrote back I actually used 34.31.29.20 (random), not 12.00.00.34 like i showed in the example, which is why i said it didn't work on digits. SELECT substring('34.31.29.20' FROM $$((\w+)\.\2)$$); substring --- (1 row) little did i know writing it with 12.00.

Re: [GENERAL] back references using regex

2005-09-08 Thread Matthew Peter
Thank you for your patience and such a complete answer. I'm not on the pgbox right now but those examples did help clarify how to reference the back references, which was my problem. I wasn't aware the 1st parenthesis must be counted as part of the regex, I assumed it was a wrapper. Thanks for he

Re: [GENERAL] back references using regex

2005-09-08 Thread Michael Fuhr
On Thu, Sep 08, 2005 at 01:52:35PM -0700, Matthew Peter wrote: > It's not a complex regex as I have wrote one that does > what I want, yet not at the database level. The docs > didn't help clarify anything. I'm still not clear on > how it determines where the back reference comes from > in the prev

Re: [GENERAL] back references using regex

2005-09-08 Thread Alvaro Herrera
On Thu, Sep 08, 2005 at 01:52:35PM -0700, Matthew Peter wrote: > What I basically want to do is have a slice function > like Python, where I can slice out items from a \s, \. > or \n\n separated list. Where I'll just change the > delimiter for the query that it applies. There is a function for s

Re: [GENERAL] back references using regex

2005-09-08 Thread Matthew Peter
I knew I should never have said Python. I know regular expressions, just not how postgresql handles them. The fact of the matter is I don't want to use Python, it was an example of the functionality I'm interested in accomplishing with pgsql. Plus, I would like to use other regex's once I figure ou

Re: [GENERAL] back references using regex

2005-09-08 Thread Michael Fuhr
On Thu, Sep 08, 2005 at 12:45:40PM -0700, Matthew Peter wrote: > Ya, but I'd have to recompile to get python in. Recompiling to add support for another procedural language is a one-time operation and it's easy to do, so that's not a good argument. > Plus, I don't want to use Python. I want to use

Re: [GENERAL] back references using regex

2005-09-08 Thread Matthew Peter
Ya, but I'd have to recompile to get python in. Plus, I don't want to use Python. I want to use and learn more pgsql. Keep things clean and lean if possible... I just got a postgres book yesterday for additional reading which it only had 2 pages on regex's in the index :( --- Peter Fein <[EMAIL PR

Re: [GENERAL] back references using regex

2005-09-08 Thread Peter Fein
Matthew Peter wrote: > That doesn't seem to work with digits > > SELECT substring('12.00.00.34' FROM $$((\d+)\.\2)$$); > or > SELECT substring('12.00.00.34' FROM $$((\w+)\.\2)$$); > > but works with strings > > SELECT substring('abc.foo.foo.xyz' FROM > $$((\w+)\.\2)$$); > > What I basically

Re: [GENERAL] back references using regex

2005-09-08 Thread Matthew Peter
That doesn't seem to work with digits SELECT substring('12.00.00.34' FROM $$((\d+)\.\2)$$); or SELECT substring('12.00.00.34' FROM $$((\w+)\.\2)$$); but works with strings SELECT substring('abc.foo.foo.xyz' FROM $$((\w+)\.\2)$$); What I basically want to do is have a slice function like Pyth

Re: [GENERAL] back references using regex

2005-09-08 Thread Michael Fuhr
[Please copy the mailing list on replies so others can participate in and learn from the discussion.] On Wed, Sep 07, 2005 at 10:40:22PM -0700, Matthew Peter wrote: > I did read the docs ;) I always do. The question I > really wanted answered is how to reference the back > references in my regula

Re: [GENERAL] back references using regex

2005-09-07 Thread Michael Fuhr
On Wed, Sep 07, 2005 at 05:26:07PM -0700, Matthew Peter wrote: > Thanks. I'll check it out asap. I didn't realize the > regex expressions needed to be escaped for it to be a > valid expression. If you use ordinary quotes (') around the regular expression then you have to escape the backslashes bec

Re: [GENERAL] back references using regex

2005-09-07 Thread Michael Fuhr
On Tue, Sep 06, 2005 at 11:40:18PM -0700, Matthew Peter wrote: > I'm trying to do a slice directly from a table so I > can get a brief preview of the articles content by > counting \s (spaces), not new paragraphs. Are you trying to extract the first N words from a string? If that's not what you m