I am trying to match the following three lines:
usemtl ftw kd 1.2 3.2 3.1 V-12.1892-53.4267-276.4055
My Regex matches the first two:
^ (\ w +) ((\ S +) (\ S +) *] $$
I have tried some variants to match negative numbers, but they do not prevent anything from being matched:
^ (\ W>) (([\ S -] +) ([\ S -] +) *) * $ ^ (\ w +) (((\ \ | | -) + ) ((\ S | -) +) *) * $
What should I do here ? -
is not a special character in regex, is it
-
Only character classes have a special character [...]
comes from your problem v-12.1892 -53.4267 -276.4055
There are two places in between v and -12.18 ...
. Your regex only matches one.
Try this regex instead:
^ (\ w +) \ s * ((\ S +) (\ S +) *) * $ < / Code>
Although your regex can be simplified (not sure which match you want to match and want to capture):
^ (\ W +) (\ s * \ S +) * $
refer to
Comments
Post a Comment