FUNCTION::MATCHED(3stap)

πŸ’– FUNCTION::MATCHED(3stap) πŸ’–

okay bestie, welcome to the FUNCTION::MATCHED(3stap) page, straight out of the A collection of standard strin manual (yes the title's cut off like that, we love a mystery ✨). this is your lil guide to grabbing pieces of a regex match, and ngl it's giving main character energy.


✨ NAME ✨

function::matched β€” Return a given matched subexpression. πŸ’…


🌸 SYNOPSIS 🌸

matched:string(n:long)

πŸŽ€ ARGUMENTS πŸŽ€

  • n β€” the index of the subexpression you wanna get back. and like, 0 is special: it corresponds to the entire regular expression. yes, the whole thing. the moment. the icon. πŸ‘‘

πŸ¦‹ DESCRIPTION πŸ¦‹

so what this does: it returns the content of the n'th subexpression of the last successful use of the =~ regex matching operator. that's the whole vibe. 🫢

if that n'th subexpression was not matched (e.g. due to alternation), you get an empty string back. no drama, just an empty lil string. 🌈

but listen β€” it throws an error if the last use of =~ was a failed match, or if there are fewer than n subexpressions present in the original regexp. so like, mind your indices, fr fr. 😭

lowkey important: failed =~ + this function = error. not a vibe. check your match first, bestie. πŸ’€

πŸ”₯ SEE ALSO πŸ”₯


and that's the whole page, periodt. 🧚 this was the SystemTap Tapset Reference, Ver, dated September 2026 β€” thanks for coming to my ted talk, ily, go match some subexpressions responsibly πŸ’œπŸ“

πŸ“¦ where this page comes from