PMATCH(9)
π pmatch(9) β kernel dev manual realness
okay so bestie, welcome to PMATCH(9) from the Kernel Developer's Manual β yes we're in kernel land, bring your flashcards π
β¨ NAME β¨
pmatch β it does pattern matching on strings, that's the whole vibe π
π¦ SYNOPSIS π¦
#include <sys/systm.h>
int
pmatch(const char *string, const char *pattern, const char **estr);
πΈ DESCRIPTION πΈ
So what it does is extract a substring matching pattern from string β like it goes digging in there and pulls out the match for you π«Ά
And if estr isn't NULL, it points at the end of the longest exact or substring match. iconic, honestly.
pmatch() uses these metacharacters, and bestie you will be memorizing them:
?β matches any single character. one (1) character, no more, no cap π*β matches any character 0 or more times. zero, one, a hundred, it does not care β¨[β defines a range of characters that will match. the range is defined by 2 characters separated by a-. and β important β the range definition has to end with a]. also, a^following the[will negate the range. lowkey chef's kiss π
π RETURN VALUES π
pmatch() will return:
2β exact match, we ate π₯1β substring match, still slay0β no match π-1β if an error occurs π
fr fr remember these are literal numbers, not booleans β2is not1, do not come for me π
mwah π that's the whole page. this one came from Debian, dated October 12, 2003 β vintage, but still serving. go forth and match some patterns, bestie π§ββοΈβ
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2003 Manuel Bouyer
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms