Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- > # this regex was suggested by Nikita in http://stackoverflow.com/a/31169781/1613005
- > a <- c("m", "2..3", "2-", "2...3", "2.4.3", "5-6-7", "2", "2.5", ".2", ".2")
- > grep(pattern="(-?0[.]\\d+)|(-?[1-9]+\\d*([.]\\d+)?)|0$", a, perl=T)
- [1] 2 3 4 5 6 7 8 9 10
- >
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement