in reply to Words in Words
Instead of using regular expresson to check if one word is a substring of another, why not use index instead.
It is a simple function that returns the offset of the shorter string within the longer one if it is a substring, or -1 it it is not. The kind of thing you expect to find in the string libaries of programing languages without regular expresson support, but so rarely used by perl programmers that most of us have forgotten the function exists.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Words in Words
by Lotus1 (Vicar) on Sep 30, 2011 at 20:44 UTC | |
Re^2: Words in Words
by LanX (Saint) on Oct 01, 2011 at 09:22 UTC | |
by choroba (Cardinal) on Oct 01, 2011 at 09:31 UTC |