Fabian Peter Hammerle před 5 roky
revize
5da7690132
1 změnil soubory, kde provedl 34 přidání a 0 odebrání
  1. 34 0
      index.html

+ 34 - 0
index.html

@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<meta charset="utf-8" />
+
+<title>Regex Tester</title>
+
+<script>
+function substitute() {
+    pattern = document.getElementById('pattern').value;
+    text = document.getElementById('text').value;
+    prefix = document.getElementById('prefix').value;
+    repl = document.getElementById('repl').value;
+    suffix = document.getElementById('suffix').value;
+    exp = new RegExp(pattern, 'g');
+    result = prefix + text.replace(exp, repl) + suffix
+    document.getElementById('result').value = result
+
+    return false;
+}
+</script>
+
+<form onsubmit="return substitute()">
+    <p>pattern <input id="pattern" value="\.\s+"></p>
+    <p>text <input id="text"></p>
+    <p>prefix <input id="prefix" value="<ul><li>"></p>
+    <p>repl <input id="repl" value="</li><li>"></p>
+    <p>suffix <input id="suffix" value="</li></ul>"></p>
+    <p><input type="submit" value="substitute"></p>
+</form>
+
+<textarea id='result'></textarea>
+
+</html>