Pattern pattern = Pattern.compile("^[a-z]+$");
String string = "abc-def";
assertTrue( pattern.matcher(string).matches() ); // obviously fails
Is it possible to have the character class match a "-" ?
|
I need to learn RegEx but don't have time to figure this out right now. -- So I'm attempting exploit the community's capabilities.
I have a string containing a list of acceptable ... |
I'm stuck with a regular expression problem.
I've got a string which I need to match. The string always starts with 2 letters, and then is followed by a 6 digit number, ... |
From what I understand, the backslash dot ("\.") means one character of any character right? So because backslash is an escape it should be backslash backslash dot ("\\.")
What does this do ... |
I am writing a java application; but stuck on this point.
Basically I have a string of Chinese characters with ALSO some possible Latin chars or numbers, lets say:
??????????????210?????.
I want to split ... |
In JavaScript this is how we can split a string at every 3-rd character
"foobarspam".match(/.{1,3}/g)
I am trying to figure out how to do this in Java. Any pointers?
|
I been trying to figure out how this blasted regex for two hours!!! It's midnight I gotta figure this out and go to bed!!!
String str = new String("filename\\");
if(str.matches(".*[?/<>|*:\"{\\}].*")) {
...
|
|
I have a string like this String str = "la$le\\$li$lo".
I want to split it to get the following output "la","le\\$li","lo". The \$ is a $ escaped so it should be left ... |
The following should be matched:
AAA123
ABCDEFGH123
XXXX123
can i do: ".*123"?
|
I read from a lot of webpage (for example: http://www.wellho.net/regex/java.html), they all mentioned that \s could represent any space charactor. But when I use \s in Java, it is ... |
I need help coming up with a regular expression to match if a string has more than one occurrence of character. I already validated the length of the two strings and ... |
Hi
I have this kind of strings and I want to obtain
Like toto100 to become toto 100
Thanks for your help
|
I was wondering if there was a regex availabe that can match a string and search for a "=" in the string.
|
I have the following strings:
<PAUL SAINT-KARL 1997-05-07>
<BOB DEAN 2001-05-07>
<GUY JEDDY 2007-05-07>
I want a java regex that would match this type of pattern "name and date" and then extract the name and ... |
I'm no expert in regex but I need to parse some input I have no control over, and make sure I filter away any strings that don't have A-z and/or 0-9.
When ... |
What regex would match any ASCII character in java?
I've already tried:
^[\\p{ASCII}]*$
but found that it didn't match lots of things that I wanted (like spaces, parentheses, etc...). I'm hoping to avoid explicitly ... |
Over last two hours I have a lot of sexy time with Thai Script strings that slipped in my database. They collate mysteriously, mutate when output, do not have natural order ... |
Hey all, so I'm trying to allow some text input which goes through a regex check before it's sent off. I want the text to only include A-Z, 0-9, and the ... |
I am parsing the request parameters to find any vulnerable characters to prevent XSS threats. Our web application supports both French and German languages other than English. I am using the ... |
I have a string that i want to parse into an array.
The given string has the form P[AB, AC, AD] (A1, A2, A3).
I want to store it in an array like ... |
I'm trying to come up with a regular expression that can match only characters not preceded by a special escape sequence in a string.
For instance, in the string Is ? stranded//? ... |
I had a look at other stackoverflow questions and couldn't find one that asked the same question, so here it is:
How do you match the first and last characters of a ... |
I am trying to match everything inside double curly brackets in a string. I am using the following expression:
\{\{.*\}\}
Some examples:
The {{dog}} is not a cat. This correctly matches {{dog}}
However,
The {{dog}} is ... |
I need to check whether a Chinese province is contained within an address in Chinese.
I am able to read and write Chinese characters easily.
I tried to use the indexOf() method of ... |
First of all I'm a toddler when it comes to regular expressions.
I need to match nested characters with their meanings stored in an array.
It's like a symbol-to-text translator.
For example, given this ... |
I have a Java program which is supposed to remove all non-letter characters from a string, except when they are a smiley face such as =) or =] or :P
It's very ... |
I would like to parse entire file based on all the possible delimiters like commas, colon, semi colons, periods, spaces, hiphens etcs.
Suppose I have a hypothetical string line "Hi,X How-how are:any ... |
I'm trying to check a string with a regular expression, and this check should only pass if the string contains only *h, *d, *w and/or *m where * can be any ... |
I'm studying up for the SCJP exam, and the following mock question caught me offguard. The explanation in the tool wasn't very good so I'm hoping the knowledgeable people of SO ... |
|
Hi all, I am trying to write a RegEx Pattern to replace the MessageFormat variables in a properties string (e.g. "My name is {0}" should be changed to "My name is {0}". What seemed like a straighforward task, is getting more complicated, because there seems to be no way to match the { character. I have tried the following, but ... |
|
|
|