Philip M
03-06-2003, 04:35 PM
I have the following which strips out single and double
quotes ' and " from the user input.
function filter(str) {
noquotes = /\'|"/g;
return str.replace(noquotes, "");
}
This works fine but I am having trouble in modifying the script
to retain single quotes (apostrophes) which do not fall on a word
boundary.
E.g. "Piper's Wood" or 'Piper's Wood' in quotes
to be changed to Piper's Wood
and not Pipers Wood
function filter(str) {
noquotes = /\'|"\b/g;
return str.replace(noquotes, "");
}
does not work.
Would you oblige me, Whammy?
quotes ' and " from the user input.
function filter(str) {
noquotes = /\'|"/g;
return str.replace(noquotes, "");
}
This works fine but I am having trouble in modifying the script
to retain single quotes (apostrophes) which do not fall on a word
boundary.
E.g. "Piper's Wood" or 'Piper's Wood' in quotes
to be changed to Piper's Wood
and not Pipers Wood
function filter(str) {
noquotes = /\'|"\b/g;
return str.replace(noquotes, "");
}
does not work.
Would you oblige me, Whammy?