RosettaCodeData/Task/Longest-common-substring/AutoHotkey/longest-common-substring-3.ahk

6 lines
149 B
AutoHotkey
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
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
}