Regex issue in IOS Program -
i trying following regex work on ios in order make sure user inputting numbers , dot. not able number of matches above 0. have tried nsrange 1 , give me 0 no matter well, regex not working, thought pretty sure should have there. suggestions.
the code wrote here errorregex defined in .h file , regerror defined well.
errorregex = [nsregularexpression regularexpressionwithpattern:@"[^0-9.]*" options: nsregularexpressioncaseinsensitive error:®error]; nsuinteger rangeoffirstmatch = [errorregex numberofmatchesinstring:servamount1tf.text options:0 range:nsmakerange(0, [servamount1tf.text length])];
why not use stock-standard c's regex.h ?
see example here: http://cboard.cprogramming.com/c-programming/117525-regex-h-extracting-matches.html
and more information here: https://stackoverflow.com/a/422159/1208218
Comments
Post a Comment