SELECT `justfunctions.eu.word_tokens`("this is a sentence", "\\s+")
/*--Output--
['this', 'is', 'a', 'sentence']
*/
CREATE OR REPLACE FUNCTION `your_project_id.your_dataset_id.word_tokens`(`string` string, `symbol` string)
RETURNS ARRAY<STRING> AS (SPLIT(REGEXP_REPLACE(LOWER(string),symbol," "), " "))
OPTIONS ( description = '''Splits a <string> into words using the specified <symbol>.''')
SQL User Defined Function (SQL UDF)
See something wrong? Contact us or report an issue on Github.