like
Builtin index · Collections & strings
result = like(s, pattern)
Input: s, pattern · Output: result
What it is
s and pattern are Strs. BASIC's wildcard match, anchored at both ends: * any run, ? any one character, # any digit, [abc]/[!abc] a set.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = like(s, pattern) | s Strnot documented yetpattern Strnot documented yet | result bool | Returns a bool. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
print(regex_find_all("a1b22c333", "[0-9]+")) # ("1", "22", "333")
print(regex_replace("2026-09-07", "([0-9]+)-([0-9]+)-([0-9]+)", "$3/$2/$1")) # "07/09/2026"
print(regex_groups("v1.2.3", "v([0-9]+)\.([0-9]+)")) # ("1", "2")
print(like("hello.txt", "*.txt")) # true
("1", "22", "333")
07/09/2026
("1", "2")
truefrom collections-strings
How it works
like(s, pattern) — BASIC's wildcard match, which is what most "does this look like that" questions actually want and is far easier to get right than a regular expression: * any run of characters ? any one character # any one digit [abc] / [!abc] a set Implemented by translating to a regex rather than by a second matcher, so the two cannot disagree about Unicode or anchoring.
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.