i am using regex to allow alphanumeric, underscore, hyphen and square brackets in a text box.
regex i am using to validate input is
<code> r'^[a-zA-Z0-9_-[] ]*$.
</code>
<code> r'^[a-zA-Z0-9_-[] ]*$.
</code>
r'^[a-zA-Z0-9_-[] ]*$.
i need to modify the regex such that if empty brackets are given it should return false.
Sample cases
“Your message here” – Valid
“Your [text] message here” – Valid
“your_text_message [text]” – valid
“Your [] message here” – Invalid
“[] message” – Invalid