use pattern and matcher classes with J\\Snos as regex. \\S matches any non-space character.

String str = "foo János bar Jxnos";
Matcher m = Pattern.compile("J\\Snos").matcher(str);
while(m.find())
{
    System.out.println(m.group());
}

Output:

János
Jxnos
Answer from Avinash Raj on Stack Overflow
Discussions

java - String Comparision without Special Character - Stack Overflow
I have strings having special characters e.g. "ravi", "Ravi" ,"!ravi","ravi...","RaVi)" etc.. I want all these to be treated as same. How to achieve this. Can be in shell script, C,C++,JAVA. T... More on stackoverflow.com
🌐 stackoverflow.com
June 4, 2011
mysql - Compare strings in java ignore special characters - Stack Overflow
please could you help me with comparing two strings with special characters in the same way as MySQL does it? For example this two strings should be equal: "Dražík" and "Drazik" More on stackoverflow.com
🌐 stackoverflow.com
May 22, 2017
java - compare 2 string in jave with special character - Stack Overflow
how to compare 2 string with special character? I have the string as below, may I know how to compare both? strA = "AC-11234X-DD+++1" strB = "AC-11234X-DD+++1" I tested matches(), equals(), More on stackoverflow.com
🌐 stackoverflow.com
January 17, 2016
How to compare two Strings in java without considering spaces? - Stack Overflow
Because my queries are multi-line static final Strings, I wanted to make sure that I didn't miss a space anywhere. To that end, I think replacing all whitespaces with a single space, or perhaps a special character is the safest solution - which then does require regex: More on stackoverflow.com
🌐 stackoverflow.com
🌐
Stack Overflow
stackoverflow.com › questions › 29408304 › compare-2-string-in-jave-with-special-character
java - compare 2 string in jave with special character - Stack Overflow
January 17, 2016 - "Must use the compareTo method." why? This should work with equals if strings would be equal, There is no need for compareTo.
🌐
W3Schools
w3schools.com › java › ref_string_comparetoignorecase.asp
Java String compareToIgnoreCase() Method
Java Examples Java Videos Java ... = "hello"; System.out.println(myStr1.compareToIgnoreCase(myStr2)); ... The compareToIgnoreCase() method compares two strings lexicographically, ignoring lower case and upper case ...
🌐
W3Schools
w3schools.com › java › ref_string_equalsignorecase.asp
Java String equalsIgnoreCase() Method
Java Examples Java Videos Java ... // true System.out.println(myStr1.equalsIgnoreCase(myStr3)); // false ... The equalsIgnoreCase() method compares two strings, ignoring lower case and upper case differences....
Find elsewhere
🌐
Medium
medium.com › @AlexanderObregon › comparing-java-strings-for-matches-and-differences-83b1969d72ff
Comparing Java Strings for Matches and Differences | Medium
June 19, 2025 - Java compares strings by looking at their characters, lengths, and memory identity depending on the method used. equals() checks for exact matches, equalsIgnoreCase() skips case differences, and compareTo() returns an ordering value based on ...
🌐
Zyrastory
zyrastory.com › front page › compare strings or characters for equality in java (ignoring case)
Compare Strings or Characters for Equality in Java (Ignoring Case) - Zyrastory - Code & Food Research Center
April 18, 2024 - Here can see the example : Codeforces 112A Petya and Strings Solution & Explanation · boolean res1 = strA.toUpperCase().equals(strB.toUpperCase()); boolean res2 = strA.toUpperCase().equals(strB.toLowerCase()); boolean res = Math.abs(charA - charB) == 32 || charA == charB; This method leverages the ASCII characteristics where uppercase and lowercase English letters have a decimal difference of 32. Math.abs(charA – charB) == 32: Indicates one character is uppercase and the other is lowercase.
🌐
CodeGym
codegym.cc › java blog › strings in java › string equalsignorecase() method in java
String equalsIgnoreCase() Method in Java
February 13, 2025 - We hope by now you understand how to compare two strings without taking case sensitivity into consideration. You can always use the String equalsIgnoreCase() Method in Java. Feel free to practice and get back here whenever you need more assistance.
🌐
Tutorjoes
tutorjoes.in › Java_example_programs › compare_two_strings_lexicographically_ignoringcase_in_java
Write a program to compare two strings lexicographically , ignoring case differences
compareToIgnoreCase() method compares two strings lexicographically while ignoring the case of the characters. It returns an integer value which is zero if the strings are equal, negative if the first string is lexicographically less than the second string, and positive if the first string ...
🌐
Udemy
blog.udemy.com › home › it & development › software development › string comparisons in java: understanding how to work with multiple strings
String Comparisons in Java: Understanding How to Work with Multiple Strings - Udemy Blog
April 14, 2026 - The String class uses various methods to compare strings and portion of strings.When we talk about comparing the strings, various factors are involved. For instance, if all string characters are matched, then the two strings are said to be equal. This is not true in case of programming languages. The string will be equal if: Both strings have same number of characters and characters match. For example, “hello world” is not the same as “helloworld”. Remember, the space is a special character in Java and is not ignored when a comparison is being performed.
🌐
w3resource
w3resource.com › java-exercises › string › java-string-exercise-14.php
Java - Compare a string to another string, ignoring case
May 21, 2025 - Write a Java program to compare two strings for equality while also ignoring any numeric characters.
🌐
Vultr Docs
docs.vultr.com › java › standard-library › java › lang › String › equalsIgnoreCase
Java String equalsIgnoreCase() - Compare Ignoring Case | Vultr Docs
December 18, 2024 - The equalsIgnoreCase() function in Java is an essential tool for string comparison that disregards the case of characters. Its ease of use and ability to prevent common user errors make it an indispensable method in Java programming.
🌐
Blogger
javarevisited.blogspot.com › 2012 › 03 › how-to-compare-two-string-in-java.html
How to compare two String in Java - String Comparison Example
String comparison is a common programming task and Java provides several way to compare two String in Java. String is a special class in Java, String is immutable and It’s used a lot in every single Java program starting from simple test to enterprise Java application.
🌐
Reddit
reddit.com › r/learnjava › is there a way to make .equalsignorecase() compare characters instead of strings?
r/learnjava on Reddit: Is there a way to make .equalsIgnoreCase() compare characters instead of Strings?
November 6, 2020 -

I have my code written exactly as it would be if i was comparing Strings, but it wont work. alternatively, changing my character to a String would likely work if there is a way to do that.

Edit- I took a shower and realized that since characters are saved as unicode values, i could just compare them like you would an integer. Eg- if(char == 65)

🌐
Stanford
web.stanford.edu › class › archive › cs › cs108 › cs108.1082 › 106a-java-handouts › HO38Strings.pdf pdf
CS106A, Stanford Handout #38 Fall, 2004-05 Nick Parlante Strings and Chars
be written in the code using single quotes (') like 'A' or 'a' or '6'. Java supports the · unicode character set, so the characters can also be non-roman letters such as 'ø' or '!'. The char type is a primitive, like int, so we use == and != to compare chars.
🌐
Oracle
docs.oracle.com › javase › tutorial › java › data › comparestrings.html
Comparing Strings and Portions of Strings (The Java™ Tutorials > Learning the Java Language > Numbers and Strings)
public class RegionMatchesDemo { public static void main(String[] args) { String searchMe = "Green Eggs and Ham"; String findMe = "Eggs"; int searchMeLength = searchMe.length(); int findMeLength = findMe.length(); boolean foundIt = false; for (int i = 0; i <= (searchMeLength - findMeLength); i++) { if (searchMe.regionMatches(i, findMe, 0, findMeLength)) { foundIt = true; System.out.println(searchMe.substring(i, i + findMeLength)); break; } } if (!foundIt) System.out.println("No match found."); } } The output from this program is Eggs.