Sunday, December 7, 2008

AHK - RegEx - Return last X lines of text/text file

RegEx For returning last X lines of a piece of text (text lines should be delimited by just LF, files by CRLF). Replace red text with # of lines. First one is for plain text, second is for text files.
RegExReplace("^.*?((`n[^`n]*){#})$","$1")
RegExReplace(data,"^(.|`r)*?((`r`n[^`r`n]*){#}})$","$2")


Forum Post

No comments: