def METHOD_NAME(self):
    """Test protection against MemoryError when replacing in RegexDetector"""
    multiplier = 30
    entity_name = 'abab'
    tag = '__{}__'.format(entity_name)
    pattern = '\\bab\\b'
    text = ' '.join(['ab'] * multiplier)
    regex_detector = RegexDetector(entity_name=entity_name, pattern=pattern)
    expected_values = ['ab'] * multiplier
    expected_original_texts = ['ab'] * multiplier
    expected_tagged_text = ' '.join(['{t}'.format(t=tag)] * multiplier)
    values, original_texts = regex_detector.detect_entity(text)
    self.assertEqual(regex_detector.tagged_text, expected_tagged_text)
    self.assertEqual(values, expected_values)
    self.assertEqual(original_texts, expected_original_texts)