Despamilator.Subject.Text (Despamilator v2.1.5)

Copy Markdown View Source

String helpers used by filters. Elixir is immutable so remove_and_count/2 returns {count, new_text} instead of mutating in place like Ruby's bang form.

Summary

Functions

Counts non-overlapping matches of pattern in text.

Removes every match of pattern and returns {count, new_text}. Mirrors Ruby's remove_and_count! semantics but immutably.

Strips http/https/mailto/ftp URIs (Ruby without_uris).

Splits on \W+, dropping empty fragments.

Functions

count(text, pattern)

Counts non-overlapping matches of pattern in text.

remove_and_count(text, pattern)

Removes every match of pattern and returns {count, new_text}. Mirrors Ruby's remove_and_count! semantics but immutably.

without_uris(text)

Strips http/https/mailto/ftp URIs (Ruby without_uris).

words(text)

Splits on \W+, dropping empty fragments.