2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/panda_mask.rb', line 2
def panda_mask(removed_text = '[removed as it violates our terms of service]')
result = self
rules = [
/[A-Za-z0-9._%+-]+\s*(\s*(\[|\()\s*at\s*(\]|\))\s*|\s*(\[|\()*@(\]|\))*\s*)\s*[A-Za-z0-9.-]+\s*(\[|\()*(\s*dot\s*|\.)(\]|\))*\s*[A-Za-z0-9]+/, /[A-Za-z0-9._%+-]+\s*at\s*[A-Za-z0-9.-]+\sdot\s*[A-Za-z0-9]+/, /\+*[-_.\dO]{7,}/,
/\+*[\dO]{3,}.[\dO]{3,}.[\dO]{3,}/, /\+*[-_.\dO]{3,}.[\dA-Z]{4,}/, ]
rules.each do |rule|
result = result.gsub(rule, removed_text)
end
result
end
|