|
On 2012-09-09 11:59 AM, "marbux" <marbux@gmail.com> wrote:
>
> On Sat, Sep 8, 2012 at 11:18 PM, Rena <hyperhacker@gmail.com> wrote:
>
> > The problem with simple string searching is it fails easily:
> >
> > if label_exists('foo') then
> > error("oops, the string '::foo::' occurs in this file")
> > end
> >
> > --::bar:: doThingsWeDontNeedRightNow()
> > if label_exists('bar') then
> > error("oh no!")
> > end
>
> It's not so problematic in the particular use case I'm looking at if
> the colons are included in the pattern to search for. E.g., "::foo::",
> "::bar::". This works because I'm searching the script's plain text
> fetched as a variable.
Well, label_exists("::foo::") (or ::bar::) would still fail both of those cases, plus would find the very line doing the search if it's in the same file.