-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
28 lines (15 loc) · 639 Bytes
/
Copy pathscript.js
File metadata and controls
28 lines (15 loc) · 639 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function validateSyntax() {
let input = document.getElementById('petInput').value.trim();
let petStart = "pet_";
let validParameter = new RegExp('^'.concat(petStart, '[0-9]{4}[a-zA-Z]+$'));
// Validation logic goes here
let result = ''; // Placeholder for validation result
if (validParameter.test(input)) {
result = 'Valid Syntax';
document.getElementById('indicator').style.backgroundColor = '#00FF00';
} else {
result = 'Invalid Syntax';
document.getElementById('indicator').style.backgroundColor = '#FF0000';
}
document.getElementById('result').innerText = result;
}