So, I like to set filters that automatically collapse certain posts that I may or may not have the mental bandwidth to engage with at any given time. Friendica lets me do this by regex, but some of them are kinda ugly
Take my Elon filter for instance. I could filter on /elon/i
, but that would falsely trigger on common words like 'melon' or 'belong'. I finally settled on /^(.*[^a-z])?elon([^a-z].*)?$/i
, but that feels overly complicated. Is there a better solution?
Edit: proofreading is for suckers.
Boyd Stephen Smith Jr.
in reply to Jonathan Lamothe • • •Sensitive content
It depends on the implementation but Perl-style has '\b' to (zero-width) match a word boundary and GNU-style has '\<' and '\>' to (zero-width) match a word start and end.
A "word start" is a non-word character (e.g. whitespace) followed by a word character (e.g. a letter). A "word end" is the reverse. A "word boundary" is either.
HTH.
Jonathan Lamothe likes this.
Jonathan Lamothe
in reply to Boyd Stephen Smith Jr. • •Boyd Stephen Smith Jr.
in reply to Jonathan Lamothe • • •Sensitive content
PHP: Hypertext Preprocessor
www.php.netJonathan Lamothe likes this.