The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. October 11, 2008, 02:09:09 AM

Login with username, password and session length


Pages: 1 [2]
  Print  
Author Topic: filtering bad characters  (Read 2437 times)
dirk
Global Moderator
Expert
*****
Offline Offline

Posts: 369


View Profile
« Reply #15 on: July 10, 2007, 05:43:29 AM »

Bompa,

the empty curly braces {} mean that the string in the preceeding curly braces
shall be replaced by nothing. So the special characters will be deleted.

Dirk
Logged
Bompa
Administrator
Expert
*****
Online Online

Posts: 192


View Profile WWW
« Reply #16 on: January 03, 2008, 05:07:57 AM »

Bompa,

the empty curly braces {} mean that the string in the preceeding curly braces
shall be replaced by nothing. So the special characters will be deleted.

Dirk

ahhh, I finally get it. 

Bompa <--- SLOW

You have an extra curly brace cuz YOU HAVE TO in order to have braces in pairs,
whereas, if we delimit with slashes, we can use jut three.

damn!

Logged

dirk
Global Moderator
Expert
*****
Offline Offline

Posts: 369


View Profile
« Reply #17 on: January 03, 2008, 10:06:59 AM »

Bompa,

here are some more examples:

Code:
$string =~ s/[^\x00-\x7E]//;
$string =~ s|[^\x00-\x7E]||;
$string =~ s~[^\x00-\x7E]~~;

$string =~ s([^\x00-\x7E])();
$string =~ s[[^\x00-\x7E]][];
$string =~ s{[^\x00-\x7E]}{};

Normally only three delimiters are required.

But if you use brackets you need 4 (two pairs).
Logged
Pages: 1 [2]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!