Dear Bots, Raptors and Humans,
I've got a little issue, I'm extracting numbers from strings with the following code:
Which works file however it does not retain negative numbers.
I've tried the following perl-esk adaption: ^-?[0-9]\\d*(.\\d+)?$
which should also capture decimals .. but I cant get it to work so clearly I'm doing something wrong.. but what? How do I get those minus signs in the correct position?
@trinker, I'm sure this will be a piece of cake for you.
Thanks,
TE
I've got a little issue, I'm extracting numbers from strings with the following code:
Code:
textstring<-c("the limits are -100 to 100")
match<- gregexpr('[0-9]+',textstring)
limits <- regmatches(textstring,match)
I've tried the following perl-esk adaption: ^-?[0-9]\\d*(.\\d+)?$
which should also capture decimals .. but I cant get it to work so clearly I'm doing something wrong.. but what? How do I get those minus signs in the correct position?
@trinker, I'm sure this will be a piece of cake for you.
Thanks,
TE