Esempio Espressioni Regolari
by Davide Caruso
HTML
<!DOCTYPE html>
<html lang="it">
<head>
<title>Esempio Espressioni Regolari</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.BodyFormat
{
font-family: "Segoe UI",calibri, arial,helvetica;
font-size: 16px;
font-weight: normal;
color: #2c0e10;
background-color: #f8f6e6;
}
.ClsBold
{
font-weight: bold;
}
.ClsP
{
margin: 10px 10px 10px 10px;
}
.ClsCenter
{
text-align: center;
}
.ClsPre
{
margin: 10px;
padding: 10px;
background: #F9F9F9;
border: 1px solid #CCCCCC;
border-radius: 4px;
font-family: Consolas, "Courier New", monospace;
tab-size: 4;
white-space: pre-wrap;
}
.ClsButton
{
background: #e8d8d8;
box-shadow: #422800 0 10px 20px -10px;
color: #422800;
border: 2px solid #d8c8c8;
border-radius: 999px;
box-sizing: border-box;
cursor: pointer;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 16px;
font-weight: 700;
line-height: 24px;
opacity: 1;
outline: 0 solid transparent;
padding: 4px 18px;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
width: fit-content;
word-break: break-word;
margin-right: 20px;
margin-bottom: 8px;
}
.ClsButton:hover
{
background: #d8c8c8;
}
</style>
</head>
<body class="BodyFormat">
<script>
window.onload = MyFunOnLoad;
function MyFunOnLoad()
{
Initialize();
}
function ClearAll()
{
document.getElementById("ExprSet").value = "";
document.getElementById("DvResult").innerHTML = "";
}
function Start()
{
document.getElementById("DvResult").innerHTML = "";
let Righe = CaricaRighe(document.getElementById("ExprSet").value);
let n = Righe.length;
Result = "";
for(let i = 0; i < n; i++)
{
try
{
Result += Righe[i] + "\t\t" + eval(Righe[i]) + "\n";
}
catch(Err)
{
Result += Righe[i] + "\t\tErrore: " + Err.message + "\n";
}
}
document.getElementById("DvResult").innerHTML = Result;
}
function...