Re: [PHP] Strip non-alphanumerics from beginning and end?

2006-08-08 Thread Brian Dunning
Perfect, thanks very much. I think I'll probably die before I'm ever handy with regex. On Aug 4, 2006, at 7:57 PM, Robert Cummings wrote: On Fri, 2006-08-04 at 19:12 -0700, Brian Dunning wrote: Is there a command to strip all non-alphanumerics form the beginning and end of a string? Ex.:

Re: [PHP] Strip non-alphanumerics from beginning and end?

2006-08-08 Thread Adam Zey
In that case you may find Regex Coach (http://weitz.de/regex-coach/) handy. It essentially does the match in real-time as you watch, and shows you exactly what each part of the regex is matching. Essentially, you paste the text to search through in the bottom pane, and start typing the regex

[PHP] Strip non-alphanumerics from beginning and end?

2006-08-04 Thread Brian Dunning
Is there a command to strip all non-alphanumerics form the beginning and end of a string? Ex.: '^%kj.h,kj..*(' becomes 'kj.h,kj' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Strip non-alphanumerics from beginning and end?

2006-08-04 Thread Robert Cummings
On Fri, 2006-08-04 at 19:12 -0700, Brian Dunning wrote: Is there a command to strip all non-alphanumerics form the beginning and end of a string? Ex.: '^%kj.h,kj..*(' becomes 'kj.h,kj' ?php $text = ereg_replace( '^[^[:alnum:]]+', '', $text ); $text = ereg_replace( '[^[:alnum:]]+$', '',