Stacy Doss wrote: $a = "this is a (test)"; $a =~ s/\W+/_/g; HTH-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of [EMAIL PROTECTED] Sent: Thursday, April 01, 2004 11:28 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: regular _expression_ question Thanks for the replying. I have another question, if I have a string like $a = "this is a (test)"; How can I change it to $a = "this_is_a_test"; How can I remove ()? Thanks Lixin -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of $Bill Luebkert Sent: Wednesday, March 31, 2004 8:27 PM To: [EMAIL PROTECTED] Subject: Re: regular _expression_ question Wagner, David --- Senior Programmer Analyst --- WGO wrote: Hey guys - what's with the HTML ?From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, March 31, 2004 16:49 To: [EMAIL PROTECTED] Subject: regular _expression_ question I have a $a which $a = "this is a test"; How can I change $a like: $a = "this_is_a_test"; No problem using $a, but if I were you, I would not. In the Perl sort $a, $b are the default variables to use and I would stay away if I were you. That said, $a =~ s/ /_/g;You could also use tr (slightly faster) : $a =~ tr/ /_/; -- hi, you might want to add the following statement after words: $a =~ s/__/_/g; # for viewing reasons... regards, topdog "i have slipped the surly bonds of earth, and danced the skies on laughter-silvered wings;" --john gillespie magee jr. |
_______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs