Options
Best way to convert Nominal values by using expressions
I’ve set of data with INCH measurement unit , the values are so missy and I’m trying to figure out a way to unified them and convert them to a way I can work with them
Example of the values :
If there’s any other way to solve this issue I would appreciate any suggestions to solve that.
Example of the values :
 1/8 , 1/16 , 19/17 , 13/3 , 1.1/8
 0.139 , 0.07 , 3.37 , .250 , 0.14
 31/8 , 11/26 , 118/23 , 101/2
 20 , 3 , 10
 0.300.40
 0.094+/0.004
 1.046 ( 11/16)
 Some of them have text and numbers
If there’s any other way to solve this issue I would appreciate any suggestions to solve that.
0
Best Answer

Optionskayman Member Posts: 662 UnicornDon't know too much on how inches work, but since your values seem seperated by comma's you could use that to split the strings into single values. If you want to keep inches you can than normalize these by replacing '' to '.' or the other way around.
If you need to convert to mm you can than generate a regex that converts the full inches and the 'sub inches'. Not sure how it's really called...
As an example, if you have 31/16 and have a regex like this :
^(d+)?[.]?(?:(\d+)/(\d+))?
You read this like 'you start with optional full digits, followed by an optional hyphen or dot, and then you have the optional divider.
Your first group would be 3, the second 1, and the third one 16, so you could create something like
($1 * 25.4) + ((25.4 / $2)/$3) to convert to mm. I have no clue if my conversion is correct by the way, but you get the idea.
Now, this works if you have a full match, in case of partials like 2/16 (so no full digits) or 20 (so no divider) it means your replacement needs to be adjusted0