How to create a regex that accepts specific characters?

How to create a regex that accepts specific characters?

I have this regex:

I have this regex:

^[[email protected]#$%&'*+-/=?^`{|}~!(),:;<>[-\]]{8,}$

I need a regex to accept a minimum word length of 8, letters(uppercase & lowercase), numbers and these characters:

!#$%&'*+-/=?^_`{|}~"(),:;<>@[]

It works when I tested it here.

This is how I used it in Java Android.

public static final String regex = "^[[email protected]#$%&'*+-/=?^`{|}~!(),:;<>[-\\]]{8,}$";

This is the error that I received.

java.util.regex.PatternSyntaxException: Missing closing bracket in character class near index 49
    ^[[email protected]#$%&'*+-/=?^`{|}~!(),:;<>[-\]]{8,}$


Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

How to Use Regex in Java

In this article, we will learn about Java Regex, and how to use Regex with examples in Java. Java regex is also known as Java Regular Expression.

Java Fundamentals: Learn Java for absolute beginners |Simpliv

Java Fundamentals: Learn Java for absolute beginners

Java Essentials : Learn Core Java From Basic to Advance

Learn Java Programming Using Practical Assignments. Start Building Back-end Web Applications Robust Test Automation Frameworks By End Of The Course. Learn More!