Re: Using a regular expression to remove all except certaincharacters.

2006-08-26 Thread Dr.Ruud
"John W. Krahn" schreef: > Dr.Ruud: >> You might actually be looking for this: >> >> (my $newstring = $oldstring) =~ tr/0-9A-Za-z/ /cds; >> >> which replaces runs of non-alphanumeric characters with a single >> space. > > No it doesn't: Oops, thanks for the correction. I was meant to be without

RE: Using a regular expression to remove all except certaincharacters.

2006-08-25 Thread Timothy Johnson
Didn't see this one before I hit 'Send'. -Original Message- From: John W. Krahn [mailto:[EMAIL PROTECTED] Sent: Friday, August 25, 2006 6:28 PM To: Perl Beginners Subject: Re: Using a regular expression to remove all except certaincharacters. John W. Krahn wrote: O

RE: Using a regular expression to remove all except certaincharacters.

2006-08-25 Thread Timothy Johnson
Comments below. -Original Message- From: John W. Krahn [mailto:[EMAIL PROTECTED] Sent: Friday, August 25, 2006 6:25 PM To: Perl Beginners Subject: Re: Using a regular expression to remove all except certaincharacters. Dr.Ruud wrote: >> >> You might actually be look

Re: Using a regular expression to remove all except certaincharacters.

2006-08-25 Thread John W. Krahn
John W. Krahn wrote: > Dr.Ruud wrote: >>Jim Schueckler schreef: >> >>>I need to remove all characters from a string except 'a'..'z', >>>'A'..'Z', and '0'..'9'. >>> >>>Could somebody please tell me the magicWords for: >>> $newstring = magicWords($oldstring);??? >>> >>>I am absolutely new to Per

Re: Using a regular expression to remove all except certaincharacters.

2006-08-25 Thread John W. Krahn
Dr.Ruud wrote: > Jim Schueckler schreef: > >>I need to remove all characters from a string except 'a'..'z', >>'A'..'Z', and '0'..'9'. >> >>Could somebody please tell me the magicWords for: >> $newstring = magicWords($oldstring);??? >> >>I am absolutely new to Perl and regular expressions, so

Re: Using a regular expression to remove all except certaincharacters.

2006-08-25 Thread Dr.Ruud
Jim Schueckler schreef: > I need to remove all characters from a string except 'a'..'z', > 'A'..'Z', and '0'..'9'. > > Could somebody please tell me the magicWords for: >$newstring = magicWords($oldstring);??? > > I am absolutely new to Perl and regular expressions, so please don't > assum

RE: Using a regular expression to remove all except certaincharacters.

2006-08-25 Thread Timothy Johnson
How about this? #Substitute any character that is not one of the ones in #our character class with nothing $newstring =~ s/[^a-zA-Z0-9]//g; Note the '^' at the start of the character class. In a character class it means "not", as in "not these characters". If you see it at the start