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

Support carriage returns, tabs, and "[0;m" #7

Merged
merged 1 commit into from
Jun 21, 2018

Conversation

zaquestion
Copy link
Contributor

This is in an effort to support cleaning the GitLab CI trace files returned from their API. The regex change is done to support "[0;m" tough to find docs but seemingly identical to "[0m"

Note: This duplicates some changes in #6 -- in testing just the carriage return handling was suitable for gitlab ci trace file cases

This is in an effort to support cleaning the GitLab CI trace files returned from their API. The regex change is done to support "[0;m" tough to find docs but seemingly identical to "[0m"
@@ -7,7 +7,7 @@ import (
)

// see regex.txt for a slightly separated version of this regex
var vt100re = regexp.MustCompile(`^\033([\[\]]([\d\?]+)?(;[\d\?]+)*)?(.)`)
var vt100re = regexp.MustCompile(`^\033([\[\]]([\d\?]+)?(;[\d\?]*)*)?([m@GCDPK;l])`)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm honestly not thrilled about ([m@GCDPK;l]), however leaving it as (.) broke this test as the r would get matched

"ccc \033]4;1;rgb:38/54/71test":       "ccc rgb:38/54/71test",

@lunixbochs
Copy link
Owner

lunixbochs commented Jun 21, 2018 via email

@zaquestion
Copy link
Contributor Author

Oops, sorry put this up late meant to include one out.txt


// [0;m cases
// TODO: trailing [0;m should probably not be overridden with [0m
// TODO: when [0;m seen, may not want to append [0m to the end
Copy link
Owner

@lunixbochs lunixbochs Jun 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain these TODOs?

@lunixbochs lunixbochs merged commit 0f3fc61 into lunixbochs:master Jun 21, 2018
@lunixbochs
Copy link
Owner

Merged manually

@lunixbochs
Copy link
Owner

I ended up diving into ECMA-48 and coming up with a much stronger primary regex. Thanks for the PR!

I also might use lab, it seems handy :)

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