I need a ereg_replace to end all ereg_replaces! (A PHP question)

777php

Diamond Member
Jul 17, 2001
3,498
0
0
I tried to create a ereg_replace to replace any and all instances of commas, dashes, slashes, etc. but whenever I try to do so I get a REG_BADRPT error.

So IE: I need something like this

$variableereg = ereg_replace('insert replace targets here', '', $variable);

I want one that takes out all of these
~`!@#$%^&*()+=[]{}\|;:'"<>?/*

:D

Thanks guys!


EDIT: I posted a similar Q in Software but I got nada! So I'm gonna try my luck here!
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
Perl code that removes all these (~`!@#$%^&*()+=[]{}\|;:'"<>?/) characters from $variableereg:

$variablereg =~ s/[~`!\@#\$%^&*()+=\[\]\{\}\\|:;'"<>?\/]//g;

It's up to you to make it work in PHP :)
 

hoihtah

Diamond Member
Jan 12, 2001
5,183
0
76
try

[][~`!@#$%^&*()+={}\|;:'"<>?/*]

$eregvariable=ereg_replace([][><~`!@#$%^&*()+={}\|;:'"?/*],"",$variable);

it works for me.

what's throwing off the system is the order of ][.
 

777php

Diamond Member
Jul 17, 2001
3,498
0
0
i did it another way, but thanks for your suggestions. I used another method, I'll post it when I get back to my work comp. :)