I'm trying to split the following string into rows such that every word is in its own row with the exception of words of a single character (e.g. a, i):
"the quick brown fox jumps over a lazy dog"
This is what I've been messing with in SQL Fiddle, but I can't get the right result:
SELECT foo FROM regexp_split_to_table('the quick brown fox jumps over a lazy dog',
E'(\\s+)(?=\\w{2,})') AS foo;
The result:
the
quick
brown
fox
jumps
over a
lazy
dog
It's almost correct, but for some reason the a is being combined with over. I want to disregard the a completely.
What's the little thing I'm missing?
SELECT foo FROM regexp_split_to_table('the quick brown fox jumps over a lazy dog', E'(?<=\\w{2,}) (?=\\w{2,})') AS foo;?select regexp_split_to_table('the quick brown fox jumps over a i lazy dog', '\s+(\w\s+)*');version 9.6and that may just be the reason. I will delete my answer and urge @Abelisto to write his or hers.