regexptester/index.html

38 lines
1.0 KiB
HTML

<!doctype html>
<html lang="zh" class="dark">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
<script src="regulex.js"></script>
<script>
window.regv = {}
window.addEventListener('DOMContentLoaded', function () {
regv.raphael = require('regulex').Raphael
regv.parse = require('regulex').parse
regv.visualize = require('regulex').visualize
regv.Kit = require('regulex').Kit
})
function vizregx(dom, reg) {
var ret
try {
ret = regv.parse(reg)
paper = regv.raphael(dom, 10, 10)
} catch (e) {
if (e instanceof parse.RegexSyntaxError) {
console.error(e)
} else throw e
return false
}
regv.visualize(ret, 'g', paper)
return true
}
</script>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>