Words with length three

1

I want to make a query that erases the words with length less than 3, that is to say in the phrase "alambre de puas 25 km" that remains "alambre puas" , I tried this query but it does not work. Any ideas?

Select REGEXP_REPLACE(columna, '( |^)[a-z]{1,3}$', "" ) as fin  
From tab 
    
asked by Adrian Rodríguez Ortiz 26.10.2018 в 20:20
source

1 answer

1

The regex you are using has several problems:

  • Only detect lowercase letters and not numbers.
  • Detects a single word given that it must be at the end of the text by $ .

The following regex detects words of between 1 and 3 characters, numbers or letters (lower case and / or upper case):

\b[a-z|A-Z|0-9]{1,3}\b
    
answered by 26.10.2018 в 22:59