Revision: 2568
Updated Code
at March 12, 2007 02:31 by jugyo
Updated Code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <style type="text/css"> textarea { font-size: 80%; width: 100%; height: 200px; } #regexText { width: 30%; } </style> <script type="text/javascript"> function grep() { var lines = document.getElementById("textarea1").value.split("\n"); var textarea2 = document.getElementById("textarea2"); var regexText = document.getElementById("regexText").value; var regex = new RegExp(regexText); var grepedText = ""; for (var i = 0; i < lines.length; i++) { var text = lines[i]; matches = regex.exec(text); if (matches != null) { grepedText += text + "\n"; } } textarea2.value = grepedText; } </script> </head> <body> <div><textarea id="textarea1" wrap="off"></textarea></div> <div> <input id="regexText" type="text" id="regex"></input> <input type="button" name="button1" value="grep" onClick="javascript:grep()" /> </div> <div><textarea id="textarea2" wrap="off"></textarea></div> </body> </html>
Revision: 2567
Updated Code
at March 12, 2007 02:30 by jugyo
Updated Code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <style type="text/css"> textarea { font-size: 80%; width: 100%; height: 200px; } #regexText { width: 30%; } </style> <script type="text/javascript"> function grep() { var lines = document.getElementById("textarea1").value.split("\n"); var textarea2 = document.getElementById("textarea2"); var regexText = document.getElementById("regexText").value; var regex = new RegExp(regexText); var grepedText = ""; for (var i = 0; i < lines.length; i++) { var text = lines[i]; matches = regex.exec(text); if (matches != null) { grepedText += text + "\n"; } } textarea2.value = grepedText; } </script> </head> <body> <div><textarea id="textarea1" wrap="off"></textarea></div> <div> <input id="regexText" type="text" id="regex"></input> <input type="button" name="button1" value="grep" onClick="javascript:grep()" /> </div> <div><textarea id="textarea2" wrap="off"></textarea></div> </body> </html>
Revision: 2566
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 12, 2007 02:25 by jugyo
Initial Code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <style type="text/css"> textarea { font-size: 80%; width: 100%; height: 200px; } #grep-text { width: 30%; } </style> <script type="text/javascript"> function grep() { var lines = document.getElementById("textarea1").value.split("\n"); var textarea2 = document.getElementById("textarea2"); var regexText = document.getElementById("regex").value; var regex = new RegExp(regexText); var grepedText = ""; for (var i = 0; i < lines.length; i++) { var text = lines[i]; matches = regex.exec(text); if (matches != null) { grepedText += text + "\n"; } } textarea2.value = grepedText; } </script> </head> <body> <div><textarea id="textarea1" wrap="off"></textarea></div> <div> <input id="grep-text" type="text" id="regex"></input> <input type="button" name="button1" value="grep" onClick="javascript:grep()" /> </div> <div><textarea id="textarea2" wrap="off"></textarea></div> </body> </html>
Initial URL
Initial Description
Initial Title
Javascript 㧠grep
Initial Tags
text
Initial Language
JavaScript