1 1.3 rillig # $NetBSD: varmod-match.mk,v 1.3 2020/08/16 20:03:53 rillig Exp $ 2 1.1 rillig # 3 1.2 rillig # Tests for the :M variable modifier, which filters words that match the 4 1.2 rillig # given pattern. 5 1.1 rillig 6 1.3 rillig all: match-char-class 7 1.3 rillig all: slow 8 1.1 rillig 9 1.3 rillig 10 1.3 rillig NUMBERS= One Two Three Four five six seven 11 1.3 rillig 12 1.3 rillig match-char-class: 13 1.3 rillig @echo '$@:' 14 1.3 rillig @echo ' uppercase numbers: ${NUMBERS:M[A-Z]*}' 15 1.3 rillig @echo ' all the others: ${NUMBERS:M[^A-Z]*}' 16 1.3 rillig @echo ' starts with non-s, ends with [ex]: ${NUMBERS:M[^s]*[ex]}' 17 1.3 rillig 18 1.3 rillig 19 1.3 rillig # Before 2020-06-13, this expression took quite a long time in Str_Match, 20 1.3 rillig # calling itself 601080390 times for 16 asterisks. 21 1.3 rillig slow: 22 1.3 rillig @: ${:U****************:M****************b} 23