Created
September 1, 2014 14:24
-
-
Save ryo1kato/6b6387ab345855544f25 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| afterLastRegexOf :: ByteStr -> ByteStr -> ByteStr | |
| afterLastRegexOf pat bstr = revSearchRE 0 bstr | |
| where | |
| re = makeRegexOpts compBlank execBlank pat | |
| revSearchRE n s | |
| | BS.null s = bstr | |
| |_ | |
| | otherwise = revSearchRE (n+lastlinelen) () | |
| where | |
| lastline = afterLastRegexOf (pack "\n") s | |
| lastlinelen = BS.length lastline |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment