RosettaCodeData/Task/Regular-expressions/Maxima/regular-expressions.maxima

6 lines
306 B
Text
Raw Permalink Normal View History

2025-08-11 18:05:26 -07:00
load("sregex")$
regex_match("\\W[A-Z]", "Hello World!"); /* returns matched substring */
regex_match("\\W[A-Z]", "Hello world!"); /* returns false if no match */
regex_subst_first("4", "[Aa]", "Abracadabra!"); /* replaces first match */
regex_subst("4", "[Aa]", "Abracadabra!"); /* replaces all matches */