Re: Regex help!

From: Date: Fri, 05 Jan 2001 01:09:48 +0000
Subject: Re: Regex help!
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-32783@lists.php.net to get a copy of this message
In article <003801c076b1$7805f840$1e01a8c0@mu.com.au>, murray@mu.com.au ("Murray Shields") wrote: > Basically, I have a whopping great log file that I would like to parse. Each > line of the log file consists of one of 70 or so sentences. EVERY sentence > takes one of the following three forms: > > [keyword1]phrase1[keyword2]phrase2 > [keyword1]phrase1[keyword2] > [keyword1]phrase1 > > Where the phrases are always consistent, but the keywors are different on > each line. What I want to know is what regex's do I need to use in order to > extract the keywords from each line? > > At this stage I am planning to store all of the phrases in a database, and > then try each one in turn until I find a match. But is there a better way? Perhaps str_replace() phrase2 for phrase1, then explode() each line using phrase1 as the separator? -- CC

« previous php.general (#32783) next »