RegEx drop everything after last pattern

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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).

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnichel@xxxxxxxxxxxxxxxxxxxxxxxxxxx	

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux