Skip to content

Commit 2dc2ef7

Browse files
author
dinh.tai
committed
Group 5
1 parent c0deaa5 commit 2dc2ef7

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

Homeworks/Answer.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Framgia Training Workshop - Linux Essential 2
2+
## Homework answer (Group 5)
3+
4+
### Homework 1
5+
File homework-1.html
6+
7+
### Homework 2
8+
/^[^abek][^gmkb]\wfe$/
9+
10+
### Homework 3
11+
/^c[^h]\w*te$/
12+
13+
### Homework 4
14+
/^\w*(sign|ect|sis)+(?!\w*(xt|de|me)$)\w*$/
15+
16+
### Homework 5
17+
/^((?!trac)\w)*$/

Homeworks/homework-1.html

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<html>
2+
<head>
3+
<script>
4+
let openFile = function(event) {
5+
let input = event.target;
6+
7+
let reader = new FileReader();
8+
reader.readAsText(input.files[0]);
9+
10+
reader.onload = function(){
11+
let lines = reader.result.split('\n');
12+
let linesResult = [];
13+
let regex = /^\|\s*(\d+)\s*\|\s*((\S+\s)+)\s*\|.*\|\s*\d{4}-(\d{2})-\d{2}\s.*\|.*\|$/;
14+
for (let i = 3; i < lines.length - 1; i++) {
15+
result = lines[i].trim().match(regex);
16+
linesResult.push(`${result[1]}|${result[2].trim()}|${result[4]}`);
17+
}
18+
19+
document.getElementById('output').innerText = linesResult.join('\n');
20+
}
21+
}
22+
</script>
23+
</head>
24+
<body>
25+
<input type='file' accept='text/plain' onchange='openFile(event)'>
26+
<br>
27+
<div id='output'>
28+
...
29+
</div>
30+
</body>
31+
</html>

0 commit comments

Comments
 (0)