Catman...y_match(3pm)

πŸ“¦
version 1.2025 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

okay bestie, gather round, because this one is Catmandu::Fix::Condition::any_match and it's literally the girl who decides whether your fixes get to run at all. ✨

She only lets the fixes execute if any path value matches the regex you hand her. that's it. that's the whole job. no cap. πŸŽ€


✨ SYNOPSIS ✨

so like, picture this: you wanna uppercase the value of field foo, but ONLY if at least one member of oogly has the value doogly. yes, really, those are the names. iconic behavior fr fr. πŸ’…

# uppercase the value of field 'foo' if at least one member of 'oogly' has the value 'doogly'
if any_match(oogly, "doogly")
  upcase(foo) # foo => 'BAR'
end

and then if you want a case insensitive search for doogly in oogly fields? say less. πŸ¦‹

# case insensitive search for 'doogly' in 'oogly' fields
if any_match(oogly.*, "(?i)doogly")
  ...
end
quick vibe check: oogly.* is a path with a wildcard, and (?i) is the inline flag that makes the regex not care about case. both of these are doing exactly what they look like they're doing. πŸ’œ

πŸ‘€ SEE ALSO πŸ‘€

  • Catmandu::Fix β€” the mothership, the main character, the whole reason any of this exists 🫢

and that's the tea, bestie. go forth and match some paths. 🌸

this page came to you courtesy of perl v5.40.1, dated 2026-01-24 β€” mwah, slay, take care of her πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from