On 12/9/05, Julien Bonastre <julien@xxxxxxxxxxxxxxxx> wrote: > Yay, Questionnaire time > > I love this part of the game > > > > a) I'm not very familiar with regex at all and was wondering if you could > tell me how your regex would handle two matched search strings that > exist within a few words of each other in the text. For example "A > larger server would be sufficient I think". > > Answer: As I think I may have mentioned "All I did was conjure up a regular > expression " > > True, I didn't imply I wrote that regex in under 32 seconds...But I'm sure I > was trying to come across with the fact that with improvement it could be > much more powerful. > > Like this example: > > http://aries.the-spectrum.org/webdev/wawd/forums/search.php?q=were%2Badd&st=post&sb%5B%5D=*&maxres=25&ob=datetime&ot=DESC > > > Is that better?? > > multiple words within the same piece of string.. > > Again, much much much more work can be done, this was a very quick "stub" > example to show the flexibility of regex.. > > Now a new issue that has been presented is if you DO have multiple words > close together it will only grab x amount of words to the before and after > that central word, including perhaps another keyword.. as you can see on > above link.. > > > Again, give me another 3 minutes in the code and I'm sure I'll work that one > too.. > > b)Also in the link you provided (reproduced below) the first matched > word is surrounded by 4 words and the second by 5 words, is there a > reason for this? > > Answer: Ooh this is my favourite :-) Yes, great reason why when you conduct > a search such as this: > http://aries.the-spectrum.org/webdev/wawd/forums/search.php?q=sufficient%2Blarge&st=post&sb%5B%5D=*&maxres=25&ob=datetime&ot=DESC > > You received the 4 word and 5 word output.. Why don't you head over to the > link that is generated on that search result entry?? > > Look around at the actual content of that forum entry and you will soon see > that the first match occurs on a line that physically only has 9 words, > therefore it can only really match what exists. > > Good point though, for a split second I actually thought to myself there > might be something wrong, but as usual and until I'm proved wrong; I'm right > again. PHP and REGEX have never failed me. > > I'm sure you all are well aware already of the saying that describes how > there is no such thing as computer errors, only stupid humans. > > And that is precisely it, I have been and still am a stupid human, and I > will usually sit there for quite a while reloading and running a regex in my > head to ensure it runs and parses as it should. > > Simple ones like this don't take too much planning, but they can get hairy > :-) > > > > > Hopefully that answers your queries Graham.. > > > > Kindest Regards to everybody! > > Julien Bonastre > <snip> Thanks for that Julien, I really must find the time to look more into Regexs. -- Graham -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php