is there a way to escape special chars 
Author Message
 is there a way to escape special chars

Hello,

Is there a way to escape a string containing special characters?  it
would make it easy to do regex on the string afterwards.

Any help would be appreciated.

Thanks.

--== Sent via Deja.com http://www.*-*-*.com/
---Share what you know. Learn what you don't.---



Sun, 04 Nov 2001 03:00:00 GMT  
 is there a way to escape special chars
[Posted and a courtesy copy mailed.]



Quote:
> Is there a way to escape a string containing special characters?  it
> would make it easy to do regex on the string afterwards.

perldoc -f quotemeta

--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/



Sun, 04 Nov 2001 03:00:00 GMT  
 is there a way to escape special chars
try:
$var =~ s/\W//g;

    \w  Match a "word" character (alphanumeric plus "_")
    \W  Match a non-word character
    \s  Match a whitespace character
    \S  Match a non-whitespace character
    \d  Match a digit character
    \D  Match a non-digit character

Hope this can help
Wing
Anyemail - Free E-mail Retriever, E-mail Aliases
http://www.anyemail.com/

Quote:

> Hello,

> Is there a way to escape a string containing special characters?  it
> would make it easy to do regex on the string afterwards.

> Any help would be appreciated.

> Thanks.

> --== Sent via Deja.com http://www.deja.com/ ==--
> ---Share what you know. Learn what you don't.---



Thu, 15 Nov 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Replacing special chars with special chars

2. escape special chars before loading into MySQL

3. Newbie - Escaping special chars in forms

4. regex to escape special characters

5. Shell special chars in file names?

6. pattern matching with special char

7. interpolate escaped chars in string

8. Adding escape chars to email address

9. Special chars

10. special chars

11. about special chars when split()

12. Text::CSV with Special Chars?

 

 
Powered by phpBB® Forum Software