Created
December 17, 2015 21:58
-
-
Save gmbecker/13ed46061c6465c7e069 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
happyfun = function(pat, txt) { | |
m = gregexpr(pat, txt, perl=TRUE)[[1]]; | |
t = attr(m, "capture.start"); | |
mapply(function(st, end) substr(txt, st, end), | |
st = t, | |
end = t+attr(m, "capture.length")-1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment