FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » preg_match() oddities and question
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
SOLVED: Re: preg_match() oddities and question [message #176130 is a reply to message #176061] Fri, 25 November 2011 09:32 Go to previous messageGo to previous message
Sandman is currently offline  Sandman
Messages: 32
Registered: August 2011
Karma:
Member
In article <mr-5B96D1(dot)12212022112011(at)News(dot)Individual(dot)NET>,
Sandman <mr(at)sandman(dot)net> wrote:

> So I have this regexp:
>
> if (preg_match("/^(.*?)\s*(\d*?)\s*([A-Z,a-z,-]*?)$/", $search, $m)){
> $streetname = uc_words($m[1]);
> $streetnumber = trim($m[2]);
> $streetletter = strtoupper($m[3]);
> $search = trim($streetname . SPACE . $streetnumber .
> $streetletter);
> }

It's funny how asking for help on the net works. Being an "oldie" I
usually turn to IRC first, mostly because it's the most direct medium,
knowledgable people may be online right there and then.

My next option usually is USENET, because I like the format and it's a
lot like mail.

But I think I need to change all of that thinking. The last few years
I've gotten the most effective help from sites such as stackoverflow,
really.

So with my problem above, I didn't find any regexp wizard online on
IRC so I came here asking it, using examples. That was two days ago. I
recived plenty of responses, some really helpful, some not so much. I
wouldn't expect immediate help and salvation from CLP really, but it's
not totally uncommon for people to at least wanting to help in some
way.

Since most replies were about the in-data or the database being
incorrect in the first place, instead of just focusing on the actual
question asked, I turned to stackoverflow. I posted a question today
at 10 am

At 10:19am, I got a clean cut, no frills solution to my actual problem:

preg_match("/([a-zA-Z ]+) ?([0-9]+)? ?([a-zA-Z]+)?/"...)

That captures *all* my examples in the OP, and formats it *exactly*
like I wanted to.

I'm not trying to disrespect anyone here, but there is a bit too much
"elitism" and "You're doing it wrong" mentality here, and have always
been. And some times it's justified, when pure newbies come here and
asks how to create a guestbook in php. But it seems this mentality
spills over to posters like me that aren't newbies but still need help.

I've been in this group for about ten years:

<http://groups.google.com/groups/profile?show=more&enc_user=YhtCLA4AAAB
X2xnmqiyRi8RpNstwOyTw&group=comp.lang.php>

But I'm proficient enough in PHP that I don't post all that often
about needing help so I'm not a "regular" here and probably easily
mistaken for a newbie.

See this as a pleed to think beyond your own preconceptions about the
proficiency of a poster, you know the entire "innocent until proven
guilty" :)

Or, just ignore it altogether. I got my solution so I'm happy either
way :)


--
Sandman[.net]
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Amazing Website!!!
Next Topic: session handler auto log out
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Feb 17 12:33:48 GMT 2025

Total time taken to generate the page: 0.03178 seconds