import re


def count_string_characters(string):
    """Count number of characters as displayed in string.

    "" -> 0 characters
    "abc" -> 3 characters
    "aaa\"aaa" -> 7 characters
    "\x27" -> 1 character
    """
    string = string[1:-1].replace(r'\\', '_').replace(r'\"', '"')
    regex = r'\\x[0-9a-f]{2}'
    return len(re.sub(regex, '_', string))