Answer the question
In order to leave comments, you need to log in
How to solve a java problem with regular expressions?
The task itself:
Use a regular expression that determines whether the given string is a hexadecimal color identifier in HTML, but is not white (#FFFFFF) or black (#000000).
example of matches: #FFFFF1, #FF3421, #00ff00.
example of inconsistencies: 232323, f#fddee, #fd2, #ffffff.
About the second part of the task (with #FFFFFF and #000000), Google did not give any information. The task does not seem difficult, but I'm at an impasse.
I made this line:
Pattern regex = Pattern.compile("#((([\\dA-Fa-f]){6}))");
Pattern regex = Pattern.compile("#((([\\dA-Fa-f]){6})&&[^(000000)] &&[^(ffffff)])");
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question