Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #3904

Re: preg_match() oddities and question

From Sandman <mr@sandman.net>
Newsgroups comp.lang.php
Subject Re: preg_match() oddities and question
Date 2011-11-24 08:28 +0100
Message-ID <mr-DF03FA.08284024112011@News.Individual.NET> (permalink)
References (3 earlier) <3004614.SPkdTlGXAF@PointedEars.de> <mr-FF0348.09552223112011@News.Individual.NET> <slrnjcpunb.85q.hellsop@nibelheim.ninehells.com> <mr-F6EC15.19011423112011@News.Individual.NET> <slrnjcqghr.85q.hellsop@nibelheim.ninehells.com>

Show all headers | View raw


In article <slrnjcqghr.85q.hellsop@nibelheim.ninehells.com>,
 "Peter H. Coffin" <hellsop@ninehells.com> wrote:

> > I thank you for your input, but I still maintain that my examples 
> > could be parsed by using a regular expression, and unless explicitly 
> > told so by using examples will I admit otherwise :-D
> 
> *grin* Any given (note: given) example set can be parsed with a
> sufficiently complicated regexp. If your task is small enough and clean
> enough, it might even not be THAT hard to accomplish. It's impossible to
> provide advice about it, though, without having that complete example
> set as well.

Huh? It was given in my OP. 

> The incoming data, however, is almost always going to
> contain data that is not clean enough and will also probably end up
> containing stuff that does not match your parsing rules, in a "because
> fools are so ingenious" sense.

Sure, but then there will be no matches of course. I'm trying to deal 
with the 99.9% of "correctly" formed search terms, though :)

> And, at that point, you'll want to be looking at how you handle those
> exeptions: reject, pass, send for clerical review, and what those
> categories mean for your process. 

Nah, if a user searchs for "34 Vikavägen B" they will get no hits, 
because no addresses in Sweden look like that. In such cases, we 
encourage the user to check their spelling of the adress and try 
again, of course :)

Basically, I have a number of examples. I want to parse them with a 
regexp. Someone here helped me solve why swedish characters broke it, 
but none yet have even tried to look at my regexp and suggest 
alterations to fit my examples.

Not that I could *expect* anything, it was just a comment on how 
common it is in groups like these for the readers to assume stupidity 
on the part of the OP and make edge cases (some more wild than others) 
where the proposed scenario would break.

I'm not stupid though, and I have a database of over 1 million 
historical search terms and looking through that I know *exactly* how 
and what people search for and now I'm looking to make sure that I can 
parse it better and with more certainity.

As a but of background, the DB that is to be searched has four 
relevant fields, one for street name, one for street number and one 
for street letter, and then one where the three are combined. It's 
this combined field I've so far used for loose string matching on the 
incoming search field, but there are still searches that won't match 
that should, so I need to parse and massage the incoming search terms.

Which brings us full circle :-D



-- 
Sandman[.net]

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

preg_match() oddities and question Sandman <mr@sandman.net> - 2011-11-22 12:21 +0100
  Re: preg_match() oddities and question The Natural Philosopher <tnp@invalid.invalid> - 2011-11-22 11:26 +0000
    Re: preg_match() oddities and question Sandman <mr@sandman.net> - 2011-11-22 12:36 +0100
    Re: preg_match() oddities and question Jerry Stuckle <jstucklex@attglobal.net> - 2011-11-22 07:22 -0500
  Re: preg_match() oddities and question tony@mountifield.org (Tony Mountifield) - 2011-11-22 11:47 +0000
    Re: preg_match() oddities and question Sandman <mr@sandman.net> - 2011-11-22 13:12 +0100
  Re: preg_match() oddities and question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-22 13:30 +0100
    Re: preg_match() oddities and question Sandman <mr@sandman.net> - 2011-11-22 13:55 +0100
      Re: preg_match() oddities and question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-22 17:56 +0100
        Re: preg_match() oddities and question The Natural Philosopher <tnp@invalid.invalid> - 2011-11-22 17:30 +0000
          Re: preg_match() oddities and question "Peter H. Coffin" <hellsop@ninehells.com> - 2011-11-22 17:20 -0600
            Re: preg_match() oddities and question The Natural Philosopher <tnp@invalid.invalid> - 2011-11-22 23:59 +0000
            Re: preg_match() oddities and question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-23 01:59 +0100
              Re: preg_match() oddities and question Sandman <mr@sandman.net> - 2011-11-23 09:58 +0100
                Re: preg_match() oddities and question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-23 22:02 +0100
                Re: preg_match() oddities and question Sandman <mr@sandman.net> - 2011-11-24 08:20 +0100
                Re: preg_match() oddities and question Denis McMahon <denismfmcmahon@gmail.com> - 2011-11-24 12:55 +0000
                Re: preg_match() oddities and question Sandman <mr@sandman.net> - 2011-11-25 09:36 +0100
                Re: preg_match() oddities and question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-24 22:41 +0100
                Re: preg_match() oddities and question Sandman <mr@sandman.net> - 2011-11-25 09:26 +0100
                Re: preg_match() oddities and question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-25 15:44 +0100
                Re: preg_match() oddities and question Sandman <mr@sandman.net> - 2011-11-25 16:34 +0100
                Re: preg_match() oddities and question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-25 23:23 +0100
              Re: preg_match() oddities and question The Natural Philosopher <tnp@invalid.invalid> - 2011-11-23 09:35 +0000
        Re: preg_match() oddities and question Sandman <mr@sandman.net> - 2011-11-23 09:55 +0100
          Re: preg_match() oddities and question "Peter H. Coffin" <hellsop@ninehells.com> - 2011-11-23 07:53 -0600
            Re: preg_match() oddities and question Sandman <mr@sandman.net> - 2011-11-23 19:01 +0100
              Re: preg_match() oddities and question The Natural Philosopher <tnp@invalid.invalid> - 2011-11-23 18:54 +0000
                Re: preg_match() oddities and question Sandman <mr@sandman.net> - 2011-11-23 20:23 +0100
              Re: preg_match() oddities and question "Peter H. Coffin" <hellsop@ninehells.com> - 2011-11-23 12:58 -0600
                Re: preg_match() oddities and question Sandman <mr@sandman.net> - 2011-11-24 08:28 +0100
  SOLVED: Re: preg_match() oddities and question Sandman <mr@sandman.net> - 2011-11-25 10:32 +0100
    Re: SOLVED: Re: preg_match() oddities and question Jerry Stuckle <jstucklex@attglobal.net> - 2011-11-25 18:55 -0500
      Re: SOLVED: Re: preg_match() oddities and question Sandman <mr@sandman.net> - 2011-11-26 11:21 +0100

csiph-web