<commit_before>﻿using System;
using System.Text.RegularExpressions;

namespace SharpRaven.Logging.Filters {
    public class PhoneNumberFilter : IFilter {
        public string Filter(string input) {
            Regex phoneRegex = new Regex(@"1?\W*([2-9][0-8][0-9])\W*([2-9][0-9]{2})\W*([0-9]{4})(\se?x?t?(\d*))?");

            phoneRegex.Replace(input, new MatchEvaluator(delegate(Match m) {
                return "##-PHONE-TRUNC-##";
            }));

            return input;
        }
    }
}<commit_msg>Fixed the PhoneNumberFilter to use the returned value from Replace(), making PhoneNumberFilterTests.Filter_PhoneNumberIsScrubbed() green.<commit_after>﻿using System.Text.RegularExpressions;

namespace SharpRaven.Logging.Filters
{
    /// <summary>
    /// An <see cref="IFilter"/> implementation for masking phone numbers in a logged message
    /// </summary>
    public class PhoneNumberFilter : IFilter
    {
        /// <summary>
        /// An <see cref="IFilter"/> implementation for masking phone numbers in a logged 
        /// </summary>
        public string Filter(string input)
        {
            Regex phoneRegex = new Regex(@"1?\W*([2-9][0-8][0-9])\W*([2-9][0-9]{2})\W*([0-9]{4})(\se?x?t?(\d*))?");
            return phoneRegex.Replace(input, delegate { return "##-PHONE-TRUNC-##"; });
        }
    }
}
{'fraction_non_alphanumeric': 0.17179294823705926, 'fraction_numerical': 0.02250562640660165, 'mean_word_length': 2.685082872928177, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3855', 'n_tokens_mistral': 434, 'n_tokens_neox': 418, 'n_words': 86}