KyleMassacre Posted February 15, 2016 Posted February 15, 2016 I am aweful at using RegEx and I just wanted to know if there was an easy way to check for a group of floats separated by a comma. Here are some things that I want to check for (basically looking for Vector3 positioning): 0.10, .10, -2.4 return true 0.10, +.10,-2.4 return true 1.0,-2.1 1.900 return false, no comma Basically a set of (3) floats with no preceding comma or trailing comma and no definite length of the fraction values and the whole number can be either 0, blank, negative, or whole and it can accept positive or negative signs. Quote
G7470 Posted February 15, 2016 Posted February 15, 2016 Would something like this work? ([-+.]*[0-9]+)+([,]*(, )*[-+.]*[0-9]+)+ (used RegExr to go through test cases appropriately) ~G7470 Quote
KyleMassacre Posted February 15, 2016 Author Posted February 15, 2016 Close but it must fail if number of sets !=3 Quote
KyleMassacre Posted February 16, 2016 Author Posted February 16, 2016 Ahh, i thought it looked funny Quote
KyleMassacre Posted February 16, 2016 Author Posted February 16, 2016 This is basically what I did. I was just curious if there was an easier way: ^([-+\d]?([.\d]+)?([,* ]))([-+\d]+([.\d]+)?([,* ]))([-+\d]+([.\d]+)){1}? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.