Re: [GENERAL] Count occurrences of pattern in string

2009-10-20 Thread Andreas Kretschmer
dario@libero.it wrote: > Hello, > > I'm looking for a function to count the occurrences of a pattern in a > string. E.g. something like: > > fun_count_pattern('fooXblaX', 'X') > > which would > return 2 (I.e. pattern 'X' found 2 times in string 'fooXblaX'). How about: test=*# select le

[GENERAL] Count occurrences of pattern in string

2009-10-20 Thread dario....@libero.it
Hello, I'm looking for a function to count the occurrences of a pattern in a string. E.g. something like: fun_count_pattern('fooXblaX', 'X') which would return 2 (I.e. pattern 'X' found 2 times in string 'fooXblaX'). I could write my own function for this (probably using plpython?) but I was