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