I just had a quick question and wanted to know if anybody could help with a regular expression question. I am currently completing the Metric-Imperial Converter from the Information Security and Quality Assurance Projects and am looking to find the regular expression that will make sure the input string is a section of digits or a fraction and then only characters at the back. I am then splitting the string and taking the number and characters to determine the quantity and unit that needs to be converted
for example-
I’m using this to separate the digits
var reg = /[a-z,A-Z]/g;
var result = input.split(reg);
result= result[0]
these inputs will pass 2344343kg, 3443lb etc but the problem is if I have a group of characters in the middle like 455ht45lb or 5uuuu43m then it will be the wrong format. I guess I also have the same problem when I try to get the unit and it is not purely characters.
So what I want to do is run it through a check to make sure it is the correct format before splitting it. Would anyone have any ideas on this???