I am trying to write a String validation to match any character (regular, digit and special) except =.
Here is what I have written –
String patternString = "[[^=][\\w\\s\\W]]*"; Pattern p = Pattern.compile(patternString); Matcher m = p.matcher(str); if(m.matches()) System.out.println("matches"); else System.out.println("does not");
But, it matches the input string “2009-09/09 12:23:12.5=” with the pattern.
How can I exclude = (or any other character, for that matter) from the pattern string?
Related Posts:
- Using or ‘|’ in regex [duplicate]
- How to match “any character” in regular expression?
- Understanding regex in Java: split(“\t”) vs split(“\\t”) – when do they both work, and when should they be used
- How to match “any character” in regular expression?
- What does regular expression \\s*,\\s* do?
- Range of valid character for a base 64 encoding
- List of all special characters that need to be escaped in a regex
- Regular Expressions on Punctuation
- How to extract a substring using regex
- Whitespace Matching Regex – Java
- How to represent a fix number of repeats in regular expression?
- How to use regex in String.contains() method in Java
- Whitespace Matching Regex – Java
- Difference between regex [A-z] and [a-zA-Z]
- Regex pattern including all special characters
- Use String.split() with multiple delimiters
- Split string into array of character strings
- Java regex email
- Can’t execute jar- file: “no main manifest attribute”
- In a simple to understand explanation, what is Runnable in Java?
- Java – How to use \t in my example [duplicate]
- Android Studio Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
- String concatenation: concat() vs “+” operator
- How to remove the last character from a string?
- Java : Comparable vs Comparator [duplicate]
- Convert int to char in java
- Change date format in a Java string
- How to request.getParameterNames into List of strings?
- How can I prevent java.lang.NumberFormatException: For input string: “N/A”?
- Compiled vs. Interpreted Languages
- How to round up to the next integer?
- How to send Https Post request in java
- What is the purpose of a listener in Java?
- stale element reference: element is not attached to the page document
- Error: can only iterate over an array or an instance of java.lang.Iterable
- Why can array constants only be used in initializers?
- Where is Java’s Array indexOf?
- How to check if an int is a null
- How do I apply the for-each loop to every character in a String?
- Session TimeOut in web.xml
- Java – removing first character of a string
- How to send a Map in JSON
- What is the significance of log4j.rootLogger property in log4j.properties file? What happens if I don’t use this property?
- “Instantiating” a List in Java? [duplicate]
- HTTP Status 405 – Request method ‘POST’ not supported (Spring MVC)
- Missing `server’ JVM (Java\jre7\bin\server\jvm.dll.)
- Convert String array to ArrayList
- java uses or overrides a deprecated API error
- What is setBounds and how do I use it?
- Exception in thread “main” java.lang.NumberFormatException: For input string: “S”
- Java Console Prompt for ENTER input before moving on [duplicate]
- Maven: Failed to read artifact descriptor
- The system cannot find the file specified in java
- Java Generate Random Number Between Two Given Values
- How to set JAVA_HOME environment variable on Mac OS X 10.9?
- Remove last character of a StringBuilder?
- Why SpringMVC Request method ‘GET’ not supported?
- Error: JAVA_HOME is not defined correctly executing maven
- Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory
- Android – SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
- How to sort an array of objects in Java?
- Filling a 2D array in Java
- How to compress a String in Java?
- The specified child already has a parent. You must call removeView() on the child’s parent first (Android)
- HTTP Status 500 Error instantiating servlet class
- How to convert the following json string to java object?
- Java end of file
- A KeyValuePair in Java
- Unclosed Character Literal error
- Java error: void cannot be converted to String
- CreateProcess error=2, The system cannot find the file specified
- Add String Array to ArrayList
- Java Array Sort descending?
- The import javafx cannot be resolved
- Java Copy Constructor ArrayLists
- Implementing an actionlistener to a JTextField
- StringIndexOutOfBoundsException String index out of range: 0
- Cannot resolve method in java
- How to Set JPanel’s Width and Height?
- java.lang.ClassNotFoundException:com.mysql.jdbc.Driver [duplicate]
- How can I check if a value is of type Integer?
- Error: package or namespace load failed for ‘rJava’
- How can I convert a char to CharSequence?
- Problems Generating A Math.random Number, Either 0 or 1
- Android Emulator: Unfortunately App has stopped
- Can we execute a java program without a main() method? [duplicate]
- How to really read text file from classpath in Java
- PrintWriter failing to print to file
- char initial value in Java
- What is the difference between local and instance variables in Java?
- Exception in thread “main” java.net.BindException: Address already in use – Error in Netbeans only
- ArithmeticException: “Non-terminating decimal expansion; no exact representable decimal result”
- I get “Type mismatch cannot convert from int to boolean” despite not using boolean
- “Cannot start compilation: the output path is not specified for module…”
- How to Retrieve value from JTextField in Java Swing?
- How to use labels in java code?
- How to call a variable in another method?
- javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake during web service communicaiton
- How to get Java to wait for user Input
- Java using enum with switch statement