Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
That's my first project when I use regex and I have a little problem when I'm validating email. I use the following formula: ^[0-9]{5,6}+(#student\\\.de)|(#teacher\\\.de) (it starts with 5 or 6 numbers and then are two alternative domains). But it's still doesn't work and I can't find the mistake in the formula. Could anyone help me?
Try
^[0-9]{5,6}#(student|teacher)\.de$
This assumes that you want a five or six digit number (possibly with proceeding zeros) followed by an at sign followed by either the student or the teacher domain.
I whould like to use ^[0-9]{5,6}#(teacher|student)\.de instead, which mean start with 5 or 6 degits followed by #teacher.de or #student.de
regex demo
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I'm taking a java class rn and my teacher did this
System.out.println("A\tB\tC\tD\tE\tF");
to see A B C D E F
but as you can see in my screenshot, it doesn't work..!!!
how can I solve this. pls help me
you can give tab space in java easily. "\t" is the space sequence in java programming. Below i have given some examples:
Example 1:
System.out.print("Happy\tBirthday");
The output:
Happy Birthday
Example 2:
System.out.print("java\tprogramming");
The output:
Java programming.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
If I were to print
System.out.println(-Math.abs(-14));
would it print -14 or would it disregard the negative sign on the outside of the Math.abs code?
You will get -14. Please go try your code first to see its behaviour
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I am unable to find issue with the format of this mail id , this is supposed to be according to the regular expression mentioned below:gt.1586#mail.dabur
^(([\w-\.]+)#((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?))$
You could try with below regular expression:
^(([^<>()\[\]\\.,;:\s#"]+(\.[^<>()\[\]\\.,;:\s#"]+)*)|(".+"))#((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$
I hope this would help you.
Your problem is with the [a-zA-Z]{2,4} section. This is trying to match the dabur section but failing because you are limiting the match to up to 4 characters and there are 5 in dabur.
Domain names used to be limited to 3 letters after the . and you have 5. This is no longer a restriction.
You can use [a-zA-Z]{2,7} or something similar but you may be better off removing that restriction entirely with [a-zA-Z]+.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to make a program that :
accepts a string of characters(initial), i.e. a DNA sequence.
The number of characters that are accepted should be given as an input before inserting the string.
Accepts a number, then receives the same number of characters
Find all the possible 'mutations' that could occur from input 2, and check in input 1 whether there are occurrences of these mutations.
Mutations are a number of strings that could be made from input 2. For example, with AGGT, GAGT, GGAT, TGGA, AGGT, ATGG, and AGTG.
So a sample run of the program would be like
2
6 4
ATGGAT
AGGT
3
Usually, when you ask a question on this site, you should show us the effort you put in your work and exactly show or tell us where do you think what you did does not work.
I am not giving you an answer, but I'm giving you better: the opportunity to learn more on the subject. You can learn about what we call in java "regular expressions" here:http://docs.oracle.com/javase/tutorial/essential/regex/
If you make an update of your query showing us what you did, people might be more encline to help you. Stackoverflow has a great community of programmers who are willing to help you just as long as you show them respect by showing where you failed and not directly asking answers for your type of problems !
Learning about regex will definetly help you out to solve this situation. If you build a method using regex and matches and you have issues with it, post what you did and what was intended with this method !
Hope it helps you :)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am writing a piece of code that allows users to enter test scores. I then need to use the Math.max and Math.min to keep track of max and min and display the answer. I am not sure where I type that code or how I type that code.
Please let me know what pieces of the code would be helpful to post!
Thanks in advance!
Start by breaking down the problem into steps and figure out what you need to know. In your case you need to know four things:
How to get input from the console
How to compare values
How to conditionally change values
How to display things to the console
One and four you can search up pretty easy. Look into "Hello world" and other such starter programs for Java. Two and three you should look up "if" statements for Java. Hope this sets you on the right track.