python regex preserve specified special characters only
Question: I've been looking for a way to isolate special characters in a regex
expression, but I only seem to find the exact opposite of what I'm looking
for. So basically I want to is something along the lines of this:

    
    
    import re
    str = "I only want characters from the pattern below to appear in a list ()[]' including quotations"
    
    pattern = """(){}[]"'-"""
    result = re.findall(pattern, str)
    

What I expect from this is:

    
    
    print(result)
    #["(", ")", "[", "]", "'"]
    

**Edit:** thank you to whomever answered then deleted their comment with this
regex that solved my problem:

    
    
    pattern = r"""[(){}\[\]"'\-]"""
    


Answer: Why would you need regex for this when it can be done without regex?

    
    
    >>> str = "I only want characters from the pattern below to appear in a list ()[]' including quotations"
    >>> pattern = """(){}[]"'-"""
    >>> [x for x in str if x in pattern]
    ['(', ')', '[', ']', "'"]
    

