Skip to content

Instantly share code, notes, and snippets.

@crguezl
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save crguezl/9107074 to your computer and use it in GitHub Desktop.

Select an option

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
[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
> 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'
@crguezl
Copy link
Author

crguezl commented Feb 20, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment