Just use:

String[] terms = input.split("[\\s@&.?$+-]+");

You can put a short-hand character class inside a character class (note the \s), and most meta-character loses their meaning inside a character class, except for [, ], -, &, \. However, & is meaningful only when comes in pair &&, and - is treated as literal character if put at the beginning or the end of the character class.

Other languages may have different rules for parsing the pattern, but the rule about - applies for most of the engines.

As @Sean Patrick Floyd mentioned in his answer, the important thing boils down to defining what constitute a word. \w in Java is equivalent to [a-zA-Z0-9_] (English letters upper and lower case, digits and underscore), and therefore, \W consists of all other characters. If you want to consider Unicode letters and digits, you may want to look at Unicode character classes.

Answer from nhahtdh on Stack Overflow
🌐
Medium
medium.com › sina-ahmadi › java-regex-6e4d073aab85
Java RegEx. special characters issue in Java split… | by Sina | My journey as a software developer | Medium
June 20, 2018 - Replace all special characters using Java’s “replaceAll” method in the input string, with escaped special characters ... escapedString = nonEscapedString.replaceAll("\\*", "\\\\*"); splittedString = escapedString.split("\\*")
🌐
Mkyong
mkyong.com › home › java › how to split a string in java
How to split a string in Java - Mkyong.com
February 9, 2022 - String phone = "012-345-678-9"; String[] output = phone.split("-", 2); System.out.println(output.length); // 2 String part1 = output[0]; // 012 String part2 = output[1]; // 345-678-9 · This section talks about escaping the special regex characters as a delimiter.
🌐
Stack Abuse
stackabuse.com › how-to-split-a-string-in-java
How to Split a String in Java
September 20, 2023 - These are: \, ^, $, ., |, ?, *, ... in regex here. If we want to split a String at one of these characters, special care has to be taken to escape these characters in the method parameters. One way we can use this is to use a backslash \. For example: ... Splits the string variable at the | ...
🌐
Real's HowTo
rgagnon.com › javadetails › java-0438.html
Split a string using String.split() - Real's Java How-to
public class StringSplit { public ... (java.util.Arrays.toString(testString.split("\\|"))); // output : [Real, How, To] } } The special character needs to be escaped with a "\" but since "\" is also a special character in Java, you need to escape it again with another ...
🌐
Coderanch
coderanch.com › t › 553464 › java › perform-split-operations-special-characters
how to perform split operations for special characters ~!^* etc..? (Beginning Java forum at Coderanch)
September 22, 2011 - You can not escape anything with |. By writing | you'r regex results in expression "something or something else". So, if you write in java: , the result will be Let's say, we can think of such "A|B" expression like: "All the places in string that is ether capital A or capital B" Each fragment in string matching such expression will be splitted out. ... No character ...
Find elsewhere
🌐
LightNode
go.lightnode.com › tech › java-string-split
Mastering Java String Split: Essential Techniques for Efficient Text Processing
April 15, 2025 - ... String data = "apple,banan... as special operators. When you need to split by these special characters (like ., *, +, etc.), you must escape them using a backslash, which itself needs to be escaped in Java strings:...
🌐
Iditect
iditect.com › program-example › regex--java-split-on-spaces-and-special-characters.html
regex - Java Split on Spaces and Special Characters
+: This quantifier matches one or more occurrences of the preceding character class. split("[^a-zA-Z0-9]+"): The split method is used with the regular expression as an argument to split the input string into an array of substrings. Adjust the regular expression according to your specific ...
🌐
How to do in Java
howtodoinjava.com › home › string › java string split() : splitting by one or multiple delimiters
Java String split() : Splitting by One or Multiple Delimiters
October 12, 2023 - The regular expression must be a valid pattern and we must remember to escape special characters if necessary. String str = "how-to-do.in.java"; String[] strArray1 = str.split("-"); //[how, to, do.in.java] - 3 tokens String[] strArray2 = str.split("-|\\."); //[how, to, do, in, java] - 5 tokens
🌐
GeeksforGeeks
geeksforgeeks.org › java › split-string-java-examples
Java String split() Method - GeeksforGeeks
May 13, 2026 - Following example splits a string using a substring instead of a character. Java · public class Geeks { public static void main(String args[]) { String s = "GeeksforGeeksforStudents"; String[] arr = s.split("for"); for (String a : arr) System.out.println(a); } } Output · Geeks Geeks Students · Explanation: The delimiter "for" appears twice. Each occurrence causes a split. The example highlights why special regex characters must be escaped.
🌐
Quora
quora.com › How-do-I-split-a-String-at-using-split-method-in-Java
How to split a String at '.' using .split() method in Java - Quora
Answer (1 of 6): .split() takes a Regular Expression as a parameter. But if you want to split on a *special character you need to use the backslash \ or a character class [“ ”] to escape these characters. So in your case you would have .split(“\\.”) or .split(“[.]”) - Example below: ...
🌐
BeginnersBook
beginnersbook.com › 2022 › 09 › split-string-by-multiple-delimiters-in-java
Split String by Multiple Delimiters in Java
September 30, 2022 - In this example, we have a string that contains multiple special characters, we want to split this string using these special characters as delimiters. We can do this by using regex, all the delimiters are specified inside brackets “[ ]“. This regex is used inside split method of Java String ...
🌐
YouTube
youtube.com › coding trainer
Java Split on Spaces and Special Characters | Java String Split on Spaces and Special Characters - YouTube
October 31, 2019 - Java Split on Spaces and Special Characters | Java String Split on Spaces and Special CharactersJust use:String[] terms = input.split("[\\s@&.?$+-]+");You ca