If found brackets found in string, then remove brackets and data inside brackets
<p>I would like to detect brackets in a string, and if found, remove the brackets and all data in the brackets</p>

<p>e.g.</p>

<p><code>Developer (12)</code></p>

<p>would become</p>

<p><code>Developer</code></p>

<p>Edit: Note that the string will be a different length/text each time, and the brackets will not always be present.</p>

<p>I can detect the brackets using something like</p>

<pre><code>if '(' in mystring: 
   print 'found it'
</code></pre>

<p>but how would I remove the <code>(12)</code>?</p>

<p>For nested brackets and multiple pairs in string this solution would work</p>

<pre><code>def replace_parenthesis_with_empty_str(str):
    new_str = ""
    stack = []
    in_bracker = False
    for c in str :
        if c == '(' :
            stack.append(c)
            in_bracker = True
            continue
        else:
            if in_bracker == True:
                if c == ')' :
                    stack.pop()
                if not len(stack):
                    in_bracker = False
            else :
                new_str += c
    return new_str

a = "fsdf(ds fOsf(fs)sdfs f(sdfsd)sd fsdf)c  sdsds (sdsd)"
print(replace_parenthesis_with_empty_str(a))
</code></pre>

python regex