in reply to Files! Reading specific parts

++skyknight!

Just an unrelated remark: if you're really searching for words rather than strings, don't forget to put word boundary markers in there:

/(.{0,100}\b$key\b.{0,100})/

Otherwise you could get some strange matches...

dave

Replies are listed 'Best First'.
Re: Re: Files! Reading specific parts
by skyknight (Hermit) on Jul 29, 2003 at 19:27 UTC
    Good point, though it would depend on the application. If you search on the word "house" and you're expecting that it will find both "house" and "houses", then you don't want the word boundary anchors, but if you're expecting to find the word exactly as you typed it, not as a substring of some pluralized word or whatnot, you are most certainly right. ++

      I speak from bitter experience, believe me. My day job is translating. Once upon a time, in a company that shall remain nameless where I was working, the helpful IT department came up, at my request, with an automated template translator into French (to avoid, in theory, our having to translate the exact same stuff every time we worked on a certain type of document: dates (January -> janvier), fields such as 'originated by', 'approved by', etc.):

      Approved by Paul Newby Approuvé par Paul Newpar

      Oh how we laughed.

      dave