C reading string and accepts only brackets dynamically
<p>I've to read a string of brackets to analyze that.
How can I read a string to be inserted in an array generated dynamically?</p>

<p>How can I avoid all characters from reading except for brackets using scanf?  [ ] { } ( ) </p>

<p>Thank you.</p>

<p>edit:
I have to read a series of brackets from keyboard but I don't know the length. So I've to create an array generated dynamically ( this is a requirement ) to contains only the space of the brackets. 
While I'm reading I want to accepts only brackets and avoid all other characters, is this possibile with scanf with the regex?</p>