- May
- 13,802
- 211
I'd like a function, say @CSI, that will be 1 if %$ contains a control sequence initiator and 0 otherwise. Given its intended use, I should be looking for "^e[". I've spent hours struggling with @REGEX with no satisfaction.
I think I can get @REGEX to do the right thing. Note: \^ and \[ remove the regex-special meanings of ^ and [.
But it fails (why?) when I try to wrap that up in @CSI.
Any ideas?
I think I can get @REGEX to do the right thing. Note: \^ and \[ remove the regex-special meanings of ^ and [.
Code:
v:\> echo %@regex["\^e\[",^e[0m]
1
v:\> echo %@regex["\^e\[","^e[0m"]
1
v:\> echo %@regex["\^e\[","^e0m"]
0
But it fails (why?) when I try to wrap that up in @CSI.
Code:
v:\> function CSI `%@regex["\^e\[",%$]`
v:\> echo %@csi[^e[0m]
0
v:\> echo %@csi[`^e[0m`]
0
v:\> echo %@csi["^e[0m"]
0
Any ideas?