I assume you're talking about C++, but without your second post there is no way of being able to tell. Just about every language has strings you know...
If thats the case it depends whether you're using std::string's or C-style char* strings. You didn't state that one either.
C style, I would scan once, find 'n' number of bad items, make a new array of (size - n), and copy the valid ones over.
Code:
int i, n, len;
char *orig, *copy;
orig = "a/string/with/a/.";
for(i = 0, n = 0, len = strlen(orig); i < len; i++)
if(orig[i] == '/' || orig[i] == '.') // check others if you want
n++;
if(n > 0) {
copy = new char[n];
// and copy the orig string over, I have to run, sorry
} else {
// string has no illegal chars'
}