regex - Delete spaces, commas, colon, semicolon with regexp -


i trying print number of words in following txt ignoring special characters =,;:'. function works, examples have found here not working properly, i've tried.

the txt is:

select name v$database; select serial# db4sql; clear   select (length (txt) - length(regexp_replace(txt, '[0-9\. ,]+$','')) 

i trying print number of words in following txt ignoring special characters =,;:'.

any make complex ignore punctuations when need count number of words. simple query using regexp_count , [[:blank:]] character class.

sql> data as(   2  select q'[select name v$database; select serial# db4sql; clear]' txt   3  dual   4  )   5  select regexp_count(txt, '[^[:blank:]]+') cnt   6  data   7  /         cnt ----------          9  sql> 

delete spaces, comas, colon, semicolon regexp

ok. if want replace punctuations , return pure alphabets, use [[:punct:]] character class.

sql> data as(   2  select q'[select name v$database; select serial# db4sql; clear]' txt   3  dual   4  )   5  select regexp_replace(txt, '[[:punct:]]') cnt   6  data   7  /  cnt ---------------------------------------------------------- select name vdatabase select serial db4sql clear  sql> 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -