I get a list of names and need to validate them. Some examples:
- Elizabeth T. Bang
- Elizabeth Bang
- Zaki M. F. El-Adawy
- joseph m. pastore, jr.
- Zaki M. F. El-Adawy
How can I use regular expressions in ... |
I have the following regex that I am using in a java application. Sometimes it works correctly and sometimes it doesn't.
<!-- <editable name=(\".*\")?> -->(.*)<!-- </editable> -->
Sometimes I will have whitespace before/after ... |
Hi I want to validate a string which donot have numeric characters.
If my string is "javaABC" then it must be validated
If my string is "java1" then it must ... |
i want a regular expression to validate string to have only text,operators and these brackets ([ ])
|
To validate names that can be
John, John Paul, etc.
I use this regex:
String regex = "[A-Z]([a-z]+|\\s[a-z]+)";
but when I do:
boolean ok = Pattern.matches(regex, "John Paul");
the matches fail?
Why? I want to use matches to ... |
I'm trying to validate some fields before persisting them to the database. In particular, I need to know that a String contains a non-whitespace character.
I'm using the javax.validation.constraints.Pattern annotation, as ... |
Can someone explain what the following regexp matches?
^.*$
Thank you!
|
|
I have developed a UI that allows users to define a regex pattern and then a replacement string that is used by appendReplacement().
e.g.
- Pattern - 7(.*)
- Replace pattern - $1
So 71234 would yield ... |
could someone help me out with a piece of regex please? I want to stop the user entering any charachter other than a-z or a hyphen -
Hope someone can help ... |
I need to validate some user input, to ensure a number entered is in the range of 1-99 inclusive. These must be whole (Integer) values
Preceeding 0 is permitted, but optional
Valid values
- 1
- 01
- 10
- 99
- 09
Invalid ... |
I have an array of bytes, I need to check if it starts with a specific number 0, terminates with 9 and in-between could be anything numbers, but after 9, I ... |
i attempted to port the code in this answer to Java:
PHP VIN number validation code
i understand that String.matches in Java is a bit temperamental and i'm very unfamiliar with regular ... |
Hey everyone,
I'm having a minor difficulty setting up a regular expression that evaluates a sentence entered by a user in a textbox to keyword(s). Essentially, the keywords have to be entered ... |
I tried like this - To validate a point like x,y
"[0-9]{1,},[0-9]{1,}"
Its not working.
UPDATE:
I must be doing something wrong. This is a simple Console input through Scanner(System.in) - using Scanner#nextLine which returns ... |
I have a flat file like:
A 10
S 20
W A 20 10
S A 45 10
S W S 20 20 20 30
W A S 22 50 20 55
I want to make sure it ... |
Less of a question and more of a validation I guess but I have created a Java application to list the available networks, through linux, and I just wanted to see ... |
Hey Guys I am building a Java XML validator without using the XML Schema which I notice is what people do. Don't ask why I am not using it.
I have my ... |
I use this regular to validate many of the input fields of my java web app:
"^[a-zA-Z0-9]+$"
But i need to modify it, because i have a couple of fields that need to ... |
I'm trying the username chains in Java with following rules:
- Length >=3
- Valid characters: a-z, A-Z, 0-9, points, dashes and underscores.
Could someone help me with the regular expression?
|
I wrote this java method to do regex and missing something because it fails for all conditions. I am new to regex and unable to figure out whats causing it to ... |
I did internationalization for my website.So my website also available in Russian language.But while gathering user information of Russian user from my web page i am not able to validate entered ... |
File Format # [filename].[2 letter locale].[outputformat - html/subject/text].xml
Valid filenames -
myname.en.html.xml
myname2.pt.subject.xml etc.
Also, filenames are coming from a column in the database.
Can somebody help me with the regex?
Thank You!
Edit# as per @drf
public static ... |
How to check if the following is part of the file name using regular expressions
.en.
.fr.
.pt.
.de.
.ja.
.es.
.it.
.cn.
I know one other way is to check the index of and return boolean.
|
I need validate a String using a Regular Expression, the String must be like "createRobot(x,y)", where x and y are digits.
I have Something like
String ins;
...
|
This seems like a well known title, but I am really facing a problem in this.
Here is what I have and what I've done so far.
I have validate input string, these ... |
My issues is to allow only a-z, A-Z, 0-9, points, dashes and underscores and [] for a given string.
Here is my code but not working so far.
[a-zA-Z0-9._-]* this one works ok ... |
I tried using this pattern
^[A-z]*[A-z,-, ]*[A-z]*
To match against a string that starts with multiple alpha characters (a-z) followed by multiple hyphens or spaces and ends with alpha characters, eg:
Azasdas- ...
|
|
|
Hi I had a look at the class String, if there exist such methods. Till now I did not get a usefull idea. Once I thought, maybe you could the method: public char[] toCharArray() Then you have to parse an array. Probably there might be for each test one loop. example: for (int i = 0; i |
Hi, I have a String of between 1 and 5 chars in length. It must contain at least one alphabetic character (i.e. a-zA-Z). The rest can be numeric or spaces. Is is possible to validate this using regex? For example: 1aa is valid 123 is not valid I tried using: ^[a-zA-Z]{1,5}$ but it doesn't work if there are any numerics in ... |
|
|
Hi all, I am new to regex and need some help. I have a file path and file name in a String. This file path and file name are accessed from a Windows machine as well as Mac machine. So, when created via the Mac machine, file path and file name can have special characters like * @ $ ? etc., ... |
Hi Check like this.I have demonstrated with the small piece of code.Just it checks the text for "*".if it finds then it prints invalid else valid. Go thru the below link for better understanding. Pattern (Java 2 Platform SE v1.4.2)) import java.util.regex.*; class LogIn { public static void main(String args[]) { String input = "sun*com"; //Checks for the string which is ... |
Why do people always try to do things with one big ugly moloch of a RE? Why not use the split( ... ) method instead? (read the String class API documenation). The split( ... ) method gives you an array of Strings, say s[], where s[0] is the first atom name s[1] and s[2] give you the second atom name and ... |
find() looks for a match anywhere in your target string so will always return true if you have an alpha in it. Use matches() if you want the WHOLE string to be alpha characters. Since your regex allows both upper and lower case characters there is no need for the CASE-INSENSITIVE flag. Also, what makes you think you need the DOTALL ... |
|
Hi, I have one problem with regular expression. I just want to validate a field where it should accept only numbers with minimum 5 and maximum 9. i tried with this regular expression. string exp = " d{5,9}"; it works fine accepting only numbers with min 5 and max 9, but what happens here is it is accepting alphabets and special ... |
|
Hi I need to validate a string such that only numbers, alphabets, -, _, . is allowed and the below mentioned code works fine. if( ! l_name.matches("[A-Za-z0-9._-]+" ) ) { // do stuff when a valid name is found } But i need to modify the above regex such that it should also allow space in the name. Any idea how ... |
Hi I wanted to validate a name input in my project to check if it contains only characters or number and special characters like .(dot), -(hyphen) or _(underscore) I have formed this regular expression to check that: if(l_name.matches("[A-Za-z0-9._-]" ) ) I am not sure whether it is right..anyway it does not work. Can somebody please correct me what is going wrong ... |
Hi all, I am new to usage of regular expressions. I need to validate an input field :- user is allowed to enter values in the following way :- ex:- 1,3,7-10,15 - Here 7-10 means (7,8,9,10). - every character other than those used here are invalid (i.e., no characters or any special characters other than comma (,) and hiphen ). Only ... |
|
|
|