This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="utf-8"> | |
<style> | |
#entree { | |
width: 100%; | |
height: 300px; | |
} | |
#regex { | |
width: 100%; | |
} | |
</style> | |
<script> | |
function testRegex () { | |
const regexText = document.querySelector("#regex").value | |
const content = document.querySelector("#entree").value.split('\n') | |
const resultat = document.querySelector("#resultat") | |
const regex = new RegExp(regexText); | |
console.log('regex', regex); | |
console.log('content', content); | |
const output = content.map(c => c.match(regex)) | |
console.log('result', output); | |
resultat.textContent = JSON.stringify(output, null, 2); | |
} | |
</script> | |
</head> | |
<body> | |
<textarea id="entree"></textarea> | |
<br> | |
<input type="text" id="regex"> | |
<br> | |
<button onclick="testRegex()">Tester la regex</button> | |
<h1>Résultat:</h1> | |
<pre id="resultat"></pre> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment