[EMAIL PROTECTED] wrote: > > In a message dated 5/4/04 5:19:49 PM Eastern Daylight Time, Jimstone77 > writes: > > > > In a message dated 5/4/04 4:14:58 PM Eastern Daylight Time, > > [EMAIL PROTECTED] writes: > > > > > > >> : > >> > >> > > >> > How would I remove any and "only" single characters from a string? > >> > > >> > $_ = "This is a character d g string test"; > >> > > >> > I want this to read "This is character string test." > >> > >> How about: > >> > >> s/\b[a-zA-Z]\b//g; > >> > >> Hope that helps. > > I tried all these substitutions. Unfortunately, they also destroy words in > the string like can't, couldn't, what's, it's, and a multitude of others. > Anyone with any solutions?
Hi. A totally different solution: $_ = q(This is a character d g string test. What's more is it's a winner and shouldn't fail.); print join ' ', grep { not /^[a-z]$/i } split; **OUTPUT This is character string test. What's more is it's winner and shouldn't fail. HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>