Builtins: Validity and gameplay queries
On this page
regex_search()#
regex_search(pattern, text, all_matches = false)Search using a regular expression. Escape backslashes for the PCA string before the regex receives it.
Returns: A match dictionary or null; an array of matches when all_matches is true.
regex_search("(KEY)-(\\d+)", "KEY-204")A match has text, start, end and groups. groups[0] is the full match. Invalid patterns report a diagnostic and return null/empty. End positions are exclusive.
to_json()#
to_json(value, indent = "")Serialize ordinary data to JSON text.
Returns: Text.
to_json({"open": true, "score": 5}, " ")Use arrays, dictionaries, numbers, text, Booleans and null for portable interchange. Vectors, colors and record references are not a general lossless format.
from_json()#
from_json(text, fallback = null)Parse JSON text.
Returns: Parsed value; fallback on invalid JSON.
from_json('{"open":true}', {})Valid JSON null stays null. This differs from the read_json_file helper’s fallback behavior.
