-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Conversation
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])`) |
There was a problem hiding this comment.
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",
Can you send me an example CI trace that needed these changes to work so I can think about cleaning this up?
|
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 |
There was a problem hiding this comment.
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?
Merged manually |
I ended up diving into ECMA-48 and coming up with a much stronger primary regex. Thanks for the PR! I also might use |
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