Last active
August 29, 2015 13:56
-
-
Save crguezl/9107074 to your computer and use it in GitHub Desktop.
PL grado ETSII: how to manage multiline assignments in INI files. Node repl session
This file contains hidden or 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
[section_one] | |
one = 1 | |
two = 2 | |
[section_two] | |
three = 3 | |
multi = multiline \ | |
support | |
; comments should be ignored | |
[section three] | |
four =4 | |
five=5 | |
six =6 | |
[section_four] | |
[section_five] | |
seven and eight= 7 & 8 |
This file contains hidden or 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
> s = 'a=b\\\nc' | |
'a=b\\\nc' | |
> n2 = /^([^=;#\r\n]+)=((?:[^;#\r\n]*\\\n)*[^;#\r\n]*)/ | |
/^([^=;#\r\n]+)=((?:[^;#\r\n]*\\\n)*[^;#\r\n]*)/ | |
> m = n2.exec(s) | |
[ 'a=b\\\nc', 'a', 'b\\\nc', index: 0, input: 'a=b\\\nc' ] | |
> d = m[2] | |
'b\\\nc' | |
> d.replace(/\\\n/g,' ') | |
'b c' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Práctica ULL-ETSII-Grado-PL "ficheros INI":
Puedes usar este gist para ver como implantar soporte multiline.
Usa el fichero
.ini
adjunto para probar su funcionamiento.