Return to Snippet

Revision: 23906
at February 11, 2011 08:52 by vagrantradio


Updated Code
//remove spaces from file name
$('input#file_name').val($('input#file_name').val().replace(/ /g,'_'));
 
//replace special chars
$('input#file_name').val($('input#file_name').val().replace(/[^a-zA-Z 0-9]+/g,''));
 
//replace just letters
$('input#file_name').val($('input#file_name').val().replace(/[^0-9]+/g,''));
 
//replace just numbers
$('input#file_name').val($('input#file_name').val().replace(/[^a-zA-Z]+/g,''));

//replace single and double quotes
$('input#file_name').val($('input#file_name').val().replace(/(\'|\")/g,''));

Revision: 23905
at February 9, 2011 02:09 by vagrantradio


Updated Code
//remove spaces from file name
$('input#file_name').val($('input#file_name').val().replace(/ /g,'_'));
 
//replace special chars
$('input#file_name').val($('input#file_name').val().replace(/[^a-zA-Z 0-9]+/g,''));
 
//replace just letters
$('input#file_name').val($('input#file_name').val().replace(/[^0-9]+/g,''));
 
//replace just numbers
$('input#file_name').val($('input#file_name').val().replace(/[^a-zA-Z]+/g,''));

//replace single and double quotes
$('input#file_name').replace(/(\'|\")/g,''));

Revision: 23904
at February 16, 2010 15:45 by vagrantradio


Initial Code
//remove spaces from file name
$('input#file_name').val($('input#file_name').val().replace(/ /g,'_'));
 
//replace special chars
$('input#file_name').val($('input#file_name').val().replace(/[^a-zA-Z 0-9]+/g,''));
 
//replace just letters
$('input#file_name').val($('input#file_name').val().replace(/[^0-9]+/g,''));
 
//replace just numbers
$('input#file_name').val($('input#file_name').val().replace(/[^a-zA-Z]+/g,''));

Initial URL

                                

Initial Description
regular expression that removes or replaces input text

Initial Title
jQuery Replace regex

Initial Tags
regex

Initial Language
jQuery