You are here: Re: RegEx drop everything after last pattern « PHP « IT news, forums, messages
Re: RegEx drop everything after last pattern

Posted by Al on 10/13/60 11:35

John Nichel wrote:
> Okay, maybe it's just the fact that I'm concentration on getting out of
> here for the holidays more than I am on my work, but I'm pulling my hair
> out. Say I have a string -
>
> Now, is the time; for all good men! to come to the aide? of their
>
> What I want to do is drop everything after (and including) the last
> punctuation mark (? in this case). I've got my pattern to match any
> punctuation mark, but I just can't get the last one (it always hits on
> the first). I'd love to use the string functions, but it has to be a
> regular expression (right now it's punctuation, but eventually it's
> going to need to be just about anything; last new line, last white
> space, last 'b', etc).
>

Consider using preg_split() and then array_pop()

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация