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 tried so other people can see exactly what you're doing and attempt to duplicate your results. Little differences sometimes matter, as this case illustrates. > SELECT substring('34.31.29.20' FROM $$((\w+)\.\2)$$); > substring > ----------- > > (1 row) > > little did i know writing it with 12.00.00.34 would > return 00.00... so yes, that did suprise me. > Apparently only using the identical values returns a > value. That's what a back reference is: it means "match the same value you matched before," not just anything that matches the same regular expression. Usenet junkies might find it amusing to use back references to search their new server's list of newsgroups: egrep '([^.]+)\.\1\.\1' newsgroups -- Michael Fuhr ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match