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,}$

java android regex

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Top Android Projects with Source Code

Android projects with source code - Work on real-time android projects. We’ll start project ideas from beginners level and later move to advance projects.

How to Install OpenJDK 11 on CentOS 8

What is OpenJDK? OpenJDk or Open Java Development Kit is a free, open-source framework of the Java Platform, Standard Edition (or Java SE).

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.

Building Dark Mode Theme in Android

Hello World, today we are going to see how we can implement a dark theme or night mode in our android application. This tutorial is going to be very simple and easy to understand. The dark theme is attractive to users and it is comfortable for low light conditions.

Top 130 Android Interview Questions - Crack Technical Interview Now!

Top Android Interview Questions & Answers from Beginner to Advanced level. Get ready to crack your next android interview with these android interview questions