Skip to content
Advertisement

How do I Count the words in a string using regex

I’m trying to count the words in a string using regex in Oracle 10g. I’ve been trying this

so that its returning titles with at least 3 words in the title.

Advertisement

Answer

INSTR is also a viable option. By looking for the second occurrence of a space, that will indicate that the string has at least 3 words.

If you do with to stick with regex, the regex expression below can be used to find books that have 3 or more words.

(Thanks @Littlefoot for the books!)

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement