Re: Regexp non-alphanumerics to spaces
- From: krahnj@xxxxxxxxx (John W. Krahn)
- Date: Fri, 30 Mar 2007 16:23:35 -0700
Dr.Ruud wrote:
"John W. Krahn" schreef:
Rob Dixon:
Grant:
$text =~ s/[[:^alnum:]\s]+/ /g;Hello, can you guys show me how to convert each non-alphanumeric$text =~ s/[^[:alnum:]]/ /g;
character in a string to a space, and then convert any number of
consecutive spaces in the string to a single space?
$text =~ s/\s+/ /g;
Isn't \s already part of [[:^alnum:]]?
Oops, yes, I was wrong. :-)
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
.
- Follow-Ups:
- Re: Regexp non-alphanumerics to spaces
- From: Dr.Ruud
- Re: Regexp non-alphanumerics to spaces
- References:
- Regexp non-alphanumerics to spaces
- From: Grant
- Re: Regexp non-alphanumerics to spaces
- From: Rob Dixon
- Re: Regexp non-alphanumerics to spaces
- From: John W. Krahn
- Re: Regexp non-alphanumerics to spaces
- From: Dr.Ruud
- Regexp non-alphanumerics to spaces
- Prev by Date: Re: Regexp non-alphanumerics to spaces
- Next by Date: Re: hash referrences and such
- Previous by thread: Re: Regexp non-alphanumerics to spaces
- Next by thread: Re: Regexp non-alphanumerics to spaces
- Index(es):
Relevant Pages
|