File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed
Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 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)* $/
Original file line number Diff line number Diff line change 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 >
You can’t perform that action at this time.
0 commit comments