View Single Post
Old 12-06-2012, 05:42 AM   PM User | #2
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,455
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
not 100% sure what you need, but hopefully you can modify this to work for you:

Code:
<!DOCTYPE html>
<html>
  <head>
    <title>file reps</title>

</head>
<body style="zoom: 1.5"> <center>
	<input type="file" onchange='readText(this)' /> <br />

	<textarea rows=10 cols=84 id="txtReps">123456, 123000</textarea> <br />
		<button onclick="rip()">run script</button>
		<button onclick="output.value=output.defaultValue;">reset</button>
	<br />

	<textarea rows=10 cols=84 id="output">http://www.mysite.com/file/folder/blah/xxxxxx/_something_else here/zzzzzz/image250  
http://www.mysite.com/file/folder/blah/xxxxxx/_something_else here/zzzzzz/image500  
http://www.mysite.com/file/folder/blah/xxxxxx/_something_else here/zzzzzz/image800  
http://www.mysite.com/file/folder/blah/xxxxxx/_something_else here/zzzzzz/image1000  </textarea>
	

	
    <script type="text/javascript">

		var reader = new FileReader();

		function rip(e) {  
			var out=(e && e.target && e.target.result) || output.value ;
			var reps=txtReps.value.split(/\s*,\s*/);
			
			output.value= out.split("\n").map(function(a){
				return a	.split("xxxxxx").join(reps[0])
						.split("zzzzzz").join(reps[1]);
			}).join("\n");
		}
					

		function readText(that){

			if(that.files && that.files[0]){
				var reader = new FileReader();
				reader.onload = rip;
				reader.readAsText(that.files[0]);
			}//end if html5 filelist support
		} 

</script>

</center>  </body>
</html>
i budgeted 15 mins, spent 14m37s
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%

Last edited by rnd me; 12-06-2012 at 05:47 AM..
rnd me is offline   Reply With Quote
Users who have thanked rnd me for this post:
jimcj1301 (12-07-2012)