Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unescape literal new-line #38

Merged
merged 1 commit into from
Aug 28, 2023
Merged

unescape literal new-line #38

merged 1 commit into from
Aug 28, 2023

Conversation

nicolasparada
Copy link
Contributor

Unescape literal new line character.

When using a config like this:

[INTPUT]
    split_me "foo\nbar"

This was unquoted and the \n inside was treated as a new line character, so doing a strings.Split(splitMe, "\n") worked as expected []string{"foo", "bar"}.

But when using a config like this:

[INTPUT]
    split_me foo\nbar

Since it does not have quotes, it was not unquoted and the \n was not treated as a new-line character but as a literal \\n. Hence doing the same split results in []string{"foo\\nbar"}.

@niedbalski niedbalski merged commit 39bf320 into main Aug 28, 2023
@niedbalski niedbalski deleted the unescape-literal-newline branch August 28, 2023 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants