Regular expression module for Quadrate.
quadpm install regexuse regex
fn main() {
"hello world" "w.*d" regex::match if {
"matched!" print nl
}
"abc123def" "[0-9]+" regex::find -> result found
found if {
result print nl // prints "123"
}
}
match(text:str pattern:str -- matched:bool)- Check if pattern matches anywhere in textmatch_full(text:str pattern:str -- matched:bool)- Check if pattern matches entire textfind(text:str pattern:str -- result:str found:bool)- Find first matchreplace(text:str pattern:str replacement:str -- result:str)- Replace all matches
.- Any character*- Zero or more+- One or more?- Zero or one[abc]- Character class[a-z]- Character range[^abc]- Negated character class^- Start of string$- End of string\d- Digit\w- Word character\s- Whitespace
MIT