Count the number of occurences of a character in a string - BigQuery
google-bigquery
Solution
SELECT LENGTH(col) - LENGTH(REGEXP_REPLACE(col, ',', '')) FROM TableName
Problem
We would like to run a query that returns no of character in the given string if i have a string say : Baitul Sharaf, 105 Hill Road, Bandra (west), Mumbai I want to count no of ',' in the above string (In above case 3) see the reference for my question Count the number of occurrences of a character in a string in Javascript I want to achieve the same in BigQuery