Click here to Skip to main content
15,885,910 members
Please Sign up or sign in to vote.
1.47/5 (3 votes)
See more:
i want read & validate elements in text file using regular expression in java wheather element is character or numeric or roman number or upper alphabet or lower alphabet .
i want solution for this

What I have tried:

i want read & validate elements in text file using regular expression in java wheather element is character or numeric or roman number or upper alphabet or lower alphabet .
i want solution for this
Posted
Updated 8-Oct-18 20:41pm
Comments
commercialweb 10-Oct-18 4:18am    
*yes i did coding for that,
*i just want to know how to check RomanNumbers using regular expression

example:For Numbers
		Pattern.matches("([1-9]|1[0-9]|2[0-6])", "20")-->this is for numbers


In the same way i want for RomanNumbers.

example: for RomanNumbers
--->i want know this how to do<---

So, you show no attempt to solve the problem yourself, you have no question, you just want us to do your HomeWork.
HomeWork problems are simplified versions of the kind of problems you will have to solve in real life, their purpose is learning and practicing.
We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.

As programmer, your job is to create algorithms that solve specific problems and you can't rely on someone else to eternally do it for you, so there is a time where you will have to learn how to. And the sooner, the better.
When you just ask for the solution, it is like trying to learn to drive a car by having someone else training.
Creating an algorithm is basically finding the maths and make necessary adaptation to fit your actual problem.
-----
Just a few interesting links to help building and debugging RegEx.
Here is a link to RegEx documentation:
perlre - perldoc.perl.org[^]
Here is links to tools to help build RegEx and debug them:
.NET Regex Tester - Regex Storm[^]
Expresso Regular Expression Tool[^]
RegExr: Learn, Build, & Test RegEx[^]
Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript[^]
This one show you the RegEx as a nice graph which is really helpful to understand what is doing a RegEx:
Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[^]
This site also show the Regex in a nice graph but can't test what match the RegEx:
Regexper[^]
 
Share this answer
 
Comments
Marco Bertschi 9-Oct-18 0:22am    
I can really recommend Expresso - A great tool which has helped me a lot throughout the time.
Patrice T 9-Oct-18 0:29am    
Have a look at Debuggex, it is the one I prefer.
To add to what the others have said, This is probably not practical with a regex.
Quote:
wheather element is character or numeric or roman number or upper alphabet or lower alphabet .

Roman numbers are characters. They are also upper or lower case characters.
So which category should they go in?
mic
dim
vim
Are they roman numbers, or words?
You need to look more closely at the files you are trying to process,and probably do itin a ore intelligent fashion than just throwing a regex at it!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900