RosettaCodeData/Task/Longest-common-substring/AutoHotkey/longest-common-substring-3.ahk
2023-07-01 13:44:08 -04:00

5 lines
149 B
AutoHotkey

LCS(a, b){
while pos := RegExMatch(a "`n" b, "(.+)(?=.*\R.*\1)", m, pos?pos+StrLen(m):1)
res := StrLen(res) > StrLen(m1) ? res : m1
return res
}