REGEX_REPLACE( {Source},
REGEX_REPLACE(REGEX_REPLACE({Source},'(^\\s*)?(((?P<str>(\\x22([^\\x22\n\\x5c]*(\\x5c\\x22)*)*\\x22)|(\\x27([^\\x27\n\\x5c]*(\\x5c\\x27)*)*\\x27))))|(([/][*](?s).*?[*][/])|([/]{2}.*))|(\\s+)|([\\s;]*$)?','$<str>'),'(?:(?P<slash>\\x5c)\\x5c)|(\\x22\\s*&\\s*\\x22)|(\\x27\\s*&\\s*\\x27)|((\\x22(?P<str0>[^\\x27\\x22\\x5c]*)\\x22)|(\\s*&\\s*)|((?P<_>\\x27)(?P<str1>[^\\x27\\x22\\x5c]*)\\x27)){3}|\\s+','$<slash>$<_>$<str0>$<str1>$<_>')
REGEX_REPLACE( REGEX_REPLACE(
REGEX_REPLACE(
REGEX_REPLACE(
LEN(REGEX_REPLACE({Code},'\\C','_'))
SUBSTITUTE(
REGEX_REPLACE(
TRIM( REGEX_REPLACE(
Filters a stringified regular expression pattern for capture group names,
REGEX_REPLACE( {Text},
A fast and reliable tokenizer that won't trip up on non-alphabet characters, date spelling conventions, smartphone model numbers, and so on. Regular expressions aren't the most scalable technology ever invented, but this one is condensed into a single formula and will hold its own in any scenario.
Counting the number of newlines in the formula's output will give you the exact word/token count.
REGEX_REPLACE( REGEX_REPLACE(
Super-useful for recompiling documentation from a fragmented / dynamic module, or bundle thereof.
REGEX_REPLACE( SWITCH(
ROUND(LEN(REGEX_REPLACE(({Body}),"(\\b|\\W)*(?P<T>(\\p{L}*[\\p{L}-]*([']\\p{L}+)?)*(?P<D>\\d+([.,]\\d+){0,2}\\w*)*)*\\s*|(\\p{P})+",'$<T>')) / LEN(REGEX_REPLACE(REGEX_REPLACE(TRIM({Body}),"(\\b|\\W)*(?P<T>(\\p{L}*[\\p{L}-]*([']\\p{L}+)?)*(?P<D>\\d+([.,]\\d+){0,2}\\w*)*)*\\s*|(\\p{P})+",'\n$<T>'),'^\\s+|\\s+$|([^\n])[^\n]*\n?','$1')),2)
'now: ' & NOW()
get_now()
DATETIME_FORMAT(created_TIME(),'X')
LEN(REGEX_REPLACE(Body,'(([^\n]+)+\n*)','_'))
ROUND(LEN(REGEX_REPLACE(Body,'(?i)(\\W*(?P<sentence>(?:[A-Z0-9])(?:[^\\?\\.\\!]+|(?:(abbr[.])|(?:m(?:r|s){1,2})|(?:e[.]g[.])|(?:fig[.])|(?:\\d+[.]\\d+)))+?(?:(?P<punc>[!?.\\p{Pi}\\p{Pf}]{1,3})\\s*))\\W*)|(?s).+','$<punc>'))/LEN(REGEX_REPLACE(Body,'(([^\n]+)+\n*)','_')),2)
ROUND(LEN(REGEX_REPLACE(REGEX_REPLACE(TRIM({Body}),"(\\b|\\W)*(?P<T>(\\p{L}*[\\p{L}-]*([']\\p{L}+)?)*(?P<D>\\d+([.,]\\d+){0,2}\\w*)*)*\\s*|(\\p{P})+",'\n$<T>'),'^\\s+|\\s+$|([^\n])[^\n]*\n?','$1'))/LEN(REGEX_REPLACE(Body,'(?i)(\\W*(?P<sentence>(?:[A-Z0-9])(?:[^\\?\\.\\!]+|(?:(abbr[.])|(?:m(?:r|s){1,2})|(?:e[.]g[.])|(?:fig[.])|(?:\\d+[.]\\d+)))+?(?:(?P<punc>[!?.\\p{Pi}\\p{Pf}]{1,3})\\s*))\\W*)|(?s).+','$<punc>')),2)
LEN(REGEX_REPLACE(REGEX_REPLACE(TRIM({Body}),"(\\b|\\W)*(?P<T>(\\p{L}*[\\p{L}-]*([']\\p{L}+)?)*(?P<D>\\d+([.,]\\d+){0,2}\\w*)*)*\\s*|(\\p{P})+",'\n$<T>'),'^\\s+|\\s+$|([^\n])[^\n]*\n?','$1'))
IF(
(?P<DMS> (
### DMS_Token_Pattern
The approach is based on the following regular expression:
REGEX_MATCH( REGEX_REPLACE({source},'(?P<HAS_GLOBAL_DEPENDENCIES>(?:\\x27(?:[^\\x27\\x5c\n]*(?:\\x5c\\x27|[^\\x27\n])*)\\x27)|(?:\\x22(?:[^\\x22\\x5c\n]*(?:\\x5c\\x22|[^\\x22\n])*)\\x22)|(?:\\x60(?:[^\\x60\\x5c]*(?:\\x5c\\x60|[^\\x60])*)\\x60))',''),'(\\b(base|console|cursor|input|output|remoteFetchAsync|session)\\b)'
\bawait|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|super|switch|static|this|throw|try|True|typeof|var|void|while|with|yield\b
LEN(REGEX_REPLACE(Body,'(?i)(\\W*(?P<sentence>(?:[A-Z0-9])(?:[^\\?\\.\\!]+|(?:(abbr[.])|(?:m(?:r|s){1,2})|(?:e[.]g[.])|(?:fig[.])|(?:\\d+[.]\\d+)))+?(?:(?P<punc>[!?.\\p{Pi}\\p{Pf}]{1,3})\\s*))\\W*)|(?s).+','$<punc>'))
REGEX_REPLACE(Name,'(^[^\\p{L}_$])|[^\\w_$]','_' ) & '_' & RECORD_ID()
REGEX_REPLACE(UPPER(REGEX_REPLACE({Source},'((?s).*?((((\\x27([^\\x27\\x5c\n]*(\\x5c\\x27|[^\\x27\n])*)\\x27)|(\\x22([^\\x22\\x5c\n]*(\\x5c\\x22|[^\\x22\n])*)\\x22))|((?P<pre>\\b)(?P<afName>(?i)(A((BS)|(ND)|(VERAGE)|(RRAY((JOIN)|(COMPACT)|(FLATTEN)|(UNIQUE)))))|(CONCATENATE)|(T(RIM)?)|(SEARCH)|(ENCODE_URL_COMPONENT)|(SUBSTITUTE)|(FIND)|(LOWER)|(UPPER)|(REPT)|(M((ID)|(OD)))|(RIGHT)|(LE(N|(FT)))|(REPLACE)|(ERROR)|(BLANK)|(FALSE)|(IF)|(NOT)|(X?OR)|(ISERROR)|(SWITCH)|(TRUE)|(COUNTA)|(CEILING)|(COUNT)|(EVEN)|(COUNTALL)|(FLOOR)|(EXP)|(LOG)|(INT)|(POWER)|(ODD)|(MAX)|(ROUND)|(ROUNDUP)|(ROUNDDOWN)|(SUM)|(SQRT)|(VALUE)|(MIN)|(DATEADD)|(DATESTR)|(DATETIME_DIFF)|(DATETIME_PARSE)|(DATETIME_FORMAT)|(DAY)|(HOUR)|(IS_BEFORE)|(IS_AFTER)|(IS_SAME)|(MONTH)|(SET_LOCALE)|(MINUTE)|(SECOND)|(SET_TIMEZONE)|(NOW)|(TONOW)|(WEEKDAY)|(TIMESTR)|(WORKDAY)|(WEEKNUM)|(WORKDAY_DIFF)|(YEAR)|(TODAY)|(FROMNOW)|(LAST_MODIFIED_TIME)|(CREATED_TIME)|(RECORD_ID)|(REGEX_MATCH)|(REGEX_EXTRACT)|(REGEX_REPLACE))(?P<post>\\b))){1,2}).*?)|.+','$<afName>\n')),'^\\s+|(\n)\n+|\\s+$','$1')
Returns a column containing all formula calls in a chronological order.
LEN(
Counts the number of formula invocations from source code.
'ok: ' & list_formula_calls()
IF( values,
REGEX_REPLACE( ARRAYJOIN(values,'\n' & REPT('~',50) & '\n'),
REGEX_REPLACE(REGEX_REPLACE(Source,'(?P<customImport>(?i)'&SUBSTITUTE(REGEX_REPLACE(ARRAYJOIN(values,'\n'&REPT('~',50)&'\n'),'(?mi)(^name:\\s*(?P<name>[^\n]+)$\nid:\\s*(?P<id>rec\\w{14})(?s).*?((\n^~{50}$(?P<n>\n))|(?-m)$))|.+','(?P<$<id>>$<name>)$<n>'),'\n','|')&'\\s*[(]\\s*[)])',SUBSTITUTE(REGEX_REPLACE(ARRAYJOIN(values,'\n'&REPT('~',50)&'\n'),'(?m)(^name:\\s*(?P<name>[^\n]+)$\nid:\\s*(?P<id>rec\\w{14})(?s).*?^sourceCode:\\s*␂(?P<CODE>[^␃]+)␃.*?((\n^~{50}$(?P<n>\n))|(?-m)$))|.+','⎡@$<id>❲@<$<id>>❳␂$<CODE>␃⎦$<n>$<n>'),'❲@<','❲$<')),'(?s)(⎡@\\w+❲❳.*?␃⎦)|(⎡@\\w+❲[^❳]+❳.*?␂(?P<INSERT>.*?)␃⎦)','$<INSERT>')