zendesk/credit_card_sanitizer — pull request #13 by vkmita (2014-09-23 20:56:04+00:00)
Title: Remove ruby 1.8 dependency code

@ggrossman

Using `\p{L}` will make compilation slower, by about 6 times,

```
>> Benchmark.realtime { 10_000.times { Regexp.compile(/\d(?:[^\p{L}_\n,]{0,8}\d[^\p{L}_\n,]{0,8}){10,17}\d/x) } }
=> 0.698607
>> Benchmark.realtime { 10_000.times { Regexp.compile(/\d(?:[^\w_\n,]{0,8}\d[^\w_\n,]{0,8}){10,17}\d/x) } }
=> 0.112387
```

but the actual processing (of Japanese for example) is ~~way faster~~ lol nvm.

```
>> Benchmark.realtime { 10_000.times { japanese_text.gsub(/\d(?:[^\w_\n,]{0,8}\d[^\w_\n,]{0,8}){10,17}\d/x, '') } }
=> 3.471511
>> Benchmark.realtime { 10_000.times { japanese_text.gsub(/\d(?:[^\p{L}_\n,]{0,8}\d[^\p{L}_\n,]{0,8}){10,17}\d/x, '') } }
=> 253.736944
```