<!DOCTYPE html>
<html>
<head><script type="text/javascript">
function onPaste(eve) {
try {
var txt = e.clipboardData.getData('text/plain');
alert(txt);
} catch (err) {
}
} </script> </head><body>
<textarea cols=60 name="inputUsaaNum" onpaste="onpaste(event);"></textarea></body></html>
please help to validate the clipboard data from text area, i need to identify the whaether it has any spacial character and also i want to delimit the values with help of carriage return(‘\r’), please help????
According to your last comments you want something like this:
txt.replace(/[^1-9_\t ]/g,'').replace(/[\t]/g,'\r');This will first replace everything that is not 1 to 9 or _ or space or a tab with ”, then it will replace all tabs with
\r. Why did I include tabs, well the asker specifies excel data.Good Luck!!
Update for your comments: