CLEO Help Cut out colors

CLEO related
Status
Not open for further replies.

Parazitas

God
Joined
Jan 2, 2017
Messages
3,121
Solutions
5
Reaction score
882
Location
Lithuania
I just wanna know if even possible cut out all colors from text?
I mean like if i have text.:
{DDBF1F} Hello {DEBC1F} world
So after cut should be like.:
Hello world

I wondering how i can do that.., i wanna make snippet or something like that.

@monday
@springfield
etc...
 
Last edited:

Parazitas

God
Joined
Jan 2, 2017
Messages
3,121
Solutions
5
Reaction score
882
Location
Lithuania
I get some errors, do you know what i doing wrong?
@monday
C++:
std::regex re(R"(.*(\{[0-9a-f]{6,8}\}).*)", std::regex:flags::icase);
std::cmatch m;
while (std::regex_match(str, m, re) == 0){
    auto pos = str.find(m[1].str());
    if (pos == -1)
        break;
    str.erase(pos, m[1].str().length());
}
// output string without colors
 
Last edited:

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
this seems to work
C++:
#include <iostream>
#include <string>
#include <regex>
#include <iterator>

using namespace std;

int main()
{
  string s ("my text{66AA66} some other text {888FF888}blah {1}{zzzzzz}\n");
  regex e (R"(\{[0-9a-fA-F]{6,8}\})");
  cout << regex_replace (s,e,"");
}
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,121
Solutions
5
Reaction score
882
Location
Lithuania
this seems to work
C++:
#include <iostream>
#include <string>
#include <regex>
#include <iterator>

using namespace std;

int main()
{
  string s ("my text{66AA66} some other text {888FF888}blah {1}{zzzzzz}\n");
  regex e (R"(\{[0-9a-fA-F]{6,8}\})");
  cout << regex_replace (s,e,"");
}

Yes working, thanks a lot.

I have one more question.
My question:
Cleo or SAMFUNCS opcodes have something like this c++ " regex " function?
The reason why i asking is - i planing to do that with cleo as well.
 
Status
Not open for further replies.
Top