in Education by
Basically i have a java String which i want to restrict all the characters other than this regex code String UcharSet = "^[a-zA-Z0-9-~!@#().]+"; if("hello.hi".matches(UcharSet)){ UNotAllowedCharEC = "0x00000030"; } now the problem is that my if statement always gets to execute although i have my regex to allow . so i really appreciate if somebody tell me what am i doing wrong. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
first i create a boolean which is equal to "hi+hello".matches(UcharSet) and i needed to create an if statement and see if it returned true or false: boolean UMORN = "hi+hello".matches(UcharSet); if(UMORN != true) UNotAllowedCharEC = "0x00000030";

Related questions

0 votes
    Which of the following matches nonword character using regular expression in java? (a) \w (b) \W (c) \ ... Regular Expressions of Java Select the correct answer from above options...
asked Feb 24, 2022 in Education by JackTerrance
0 votes
    Which of the following matches end of the string using regular expression in java? (a) \z (b) \\ (c ... Regular Expressions of Java Select the correct answer from above options...
asked Feb 24, 2022 in Education by JackTerrance
0 votes
    Which of the following is not a class of java.util.regex? (a) Pattern class (b) matcher class (c) ... Regular Expressions of Java Select the correct answer from above options...
asked Feb 24, 2022 in Education by JackTerrance
0 votes
    Which of these class is used to read characters and strings in Java from console? (a) BufferedReader (b) ... & Applets of Java Select the correct answer from above options...
asked Feb 24, 2022 in Education by JackTerrance
0 votes
    Which of the following matches nonword character using regular expression in java? (a) \w (b) \W ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
0 votes
    I need to check if an external window (another java program, but not controlled by the program that I ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 27, 2022 in Education by JackTerrance
0 votes
    Which feature of java 8 enables us to create a work stealing thread pool using all available processors at ... Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    How to read entire file in one line using java 8? (a) Files.readAllLines() (b) Files.read() (c) ... Autoboxing & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of the following is advantage of using PreparedStatement in Java? (a) Slow performance (b) Encourages SQL ... JDBC of Java Select the correct answer from above options...
asked Feb 22, 2022 in Education by JackTerrance
0 votes
    I use Selenium RC, for which the scroll command is selenium.getEval("scrollBy(0, 250)"); Now, I have started ... the command for it? Select the correct answer from above options...
asked Jan 23, 2022 in Education by JackTerrance
0 votes
    Apigee allows you to restrict the number of results returned from BaaS using the parameter _____. limit max number threshold...
asked Sep 3, 2021 in Technology by JackTerrance
0 votes
    Let's say, I have a folder called maps and inside maps I have map1.txt, map2.txt, and map3.txt. ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 8, 2022 in Education by JackTerrance
0 votes
    We have a library where users can pass in dates in multiple formats. They follow the ISO but are ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 22, 2022 in Education by JackTerrance
0 votes
    Is it possible to add the numbers 1 to n recursively in Java with one return statement? How would ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 4, 2022 in Education by JackTerrance
...