Regex for MM2

Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.

Do not post RoM-Bot stuff here. There is a subforum for that.
Forum rules
This is a sub-forum for things specific to MicroMacro.

This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
Post Reply
Message
Author
User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Regex for MM2

#1 Post by BlubBlab » Thu Dec 03, 2015 4:16 pm

Hi since lua's regex have their limits and not full suport all of them I thought i could make for the string add-on some extra functions but runned into some problems:

Code: Select all

1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(1019): error C2039: 'difference_type': is not a member of 'std::iterator_traits<_BidIt>'
1>          with
1>          [
1>              _BidIt=int
1>          ]
1>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(2904): note: see reference to class template instantiation 'std::match_results<_BidIt,std::allocator<std::sub_match<_BidIt>>>' being compiled
1>          with
1>          [
1>              _BidIt=int
1>          ]
1>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(2952): note: see reference to function template instantiation '_OutIt std::_Regex_replace<_Iter,int,std::regex_traits<char>,char,std::char_traits<char>,std::allocator<char>>(_OutIt,_BidIt,_BidIt,const std::basic_regex<char,std::regex_traits<char>> &,const std::basic_string<char,std::char_traits<char>,std::allocator<char>> &,std::regex_constants::match_flag_type)' being compiled
1>          with
1>          [
1>              _OutIt=std::back_insert_iterator<std::string>,
1>              _Iter=std::back_insert_iterator<std::string>,
1>              _BidIt=int
1>          ]
1>  string_addon.cpp(342): note: see reference to function template instantiation '_OutIt std::regex_replace<std::back_insert_iterator<std::string>,int,std::regex_traits<char>,char,std::char_traits<char>,std::allocator<char>>(_OutIt,_BidIt,_BidIt,const std::basic_regex<char,std::regex_traits<char>> &,const std::basic_string<char,std::char_traits<char>,std::allocator<char>> &,std::regex_constants::match_flag_type)' being compiled
1>          with
1>          [
1>              _OutIt=std::back_insert_iterator<std::string>,
1>              _BidIt=int
1>          ]
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(1019): error C3646: 'difference_type': unknown override specifier
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(1019): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(1022): error C2039: 'value_type': is not a member of 'std::iterator_traits<_BidIt>'
1>          with
1>          [
1>              _BidIt=int
1>          ]
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(550): error C2039: 'value_type': is not a member of 'std::iterator_traits<_BidIt>'
1>          with
1>          [
1>              _BidIt=int
1>          ]
1>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(1365): note: see reference to class template instantiation 'std::sub_match<_BidIt>' being compiled
1>          with
1>          [
1>              _BidIt=int
1>          ]
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(550): error C3646: 'value_type': unknown override specifier
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(550): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(551): error C2039: 'difference_type': is not a member of 'std::iterator_traits<_BidIt>'
1>          with
1>          [
1>              _BidIt=int
1>          ]
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(551): error C3646: 'difference_type': unknown override specifier
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(551): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(2916): error C2664: '_OutIt std::match_results<_BidIt,std::allocator<std::sub_match<_BidIt>>>::_Format<_OutIt>(_OutIt,const std::sub_match<_BidIt> *,const std::sub_match<_BidIt> *,std::regex_constants::match_flag_type) const': cannot convert argument 2 from 'const char *' to 'const std::sub_match<_BidIt> *'
1>          with
1>          [
1>              _OutIt=std::back_insert_iterator<std::string>,
1>              _BidIt=int
1>          ]
1>          and
1>          [
1>              _BidIt=int
1>          ]
1>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\regex(2916): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I have not really an idea what going wrong besides some types get mixed. I haven't used template so I have not an idea where to start and yeahh asked the Internet but couldn't find a good answer.( I tried namespace collusions but this seems not to be th problem here)
Attachments
string_addon.h
(892 Bytes) Downloaded 579 times
string_addon.cpp
(9.27 KiB) Downloaded 564 times
Last edited by BlubBlab on Thu Dec 03, 2015 8:18 pm, edited 1 time in total.
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
Administrator
Site Admin
Posts: 5318
Joined: Sat Jan 05, 2008 4:21 pm

Re: Regex for MM2

#2 Post by Administrator » Thu Dec 03, 2015 8:03 pm

Unless I'm mistaken, that looks like something is wrong with the headers included with VC++. Leave it to Microsoft to put out a broken compiler.

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Regex for MM2

#3 Post by BlubBlab » Thu Dec 03, 2015 8:36 pm

Thx I will try something else and see if that helps if not MS got my fury^^
Anyway I started to multi-task since I got my new PC soo much to do
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Regex for MM2

#4 Post by BlubBlab » Sun Dec 13, 2015 10:58 am

Okay I solved this problem a while ago when Lisa requested that other stuff. The reason was some problem with a function parameter.

I wanted to ask what is needed or which name should that all have ? I think Admin might be interested in it so instead of 2 different codes it would be better we have 1 solution.

What I have until now is

Code: Select all

/*	string.regex_match(string str, string regex)
Returns:	string

 Test if the value fits the regex
 return true if it does and false if it doesn't
*/
/*	string.regex_search(string str, string regex)
Returns:	string

Test if the value fits the regex
return first the matching parts
*/
/*	string.regex_search_all(string str, string regex)
Returns:	string

Test if the value fits the regex
return all matching parts as multiple return values
*/
/*	string.regex_replace_all(string str, string regex, string withwhat)
Returns:	string

replace all positions in which the regex match with given string
and then return the string
*/
/*	string.regex_replace(string str, string regex, string withwhat, int start, int ende)
Returns:	string

replace all positions in which the regex match with given string
and then return the string
*/
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
Administrator
Site Admin
Posts: 5318
Joined: Sat Jan 05, 2008 4:21 pm

Re: Regex for MM2

#5 Post by Administrator » Sun Dec 13, 2015 12:56 pm

Only thing would be in the naming convention. Either regex.function, or string.regexFunction would apply, but we don't use snake-case in function names.

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Regex for MM2

#6 Post by BlubBlab » Fri Dec 18, 2015 2:34 pm

Sry took me some while I went for string.regexFunction my original thought were also that I could replace also the original function just with full regex support like string.find or string.gsub . I came to the idea by looking to Autohotkey which has basically the same functions like MicroMacro , so the idea was jut add what we missing and we are better because we have full lua support not some exotic BASIC like language which just exists for Autohotkey.

So the idea was setting up MM2 wider(not much) because ROM will be properly besides private Servers be gone at the middle of next year.
I follow a smiler idea with my bot framework so that I could in theory with the same source-code control a real bot in real-life with some adjustments and change the I/O layer I put in for that.

The idea is attract more people who can use it for different things

By the way the problem with the OpenAL dll I had led my to notice that OpenAl and Lua have new version which released.
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
Administrator
Site Admin
Posts: 5318
Joined: Sat Jan 05, 2008 4:21 pm

Re: Regex for MM2

#7 Post by Administrator » Fri Dec 18, 2015 2:57 pm

Yeah... I've been meaning to compile those. Actually had done the 64-bit libraries and then got kind of sidetracked with other things. I'm told that I'll be working hard until mid March at the earliest.

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Regex for MM2

#8 Post by BlubBlab » Fri Dec 18, 2015 3:36 pm

Not much different here I have already compiled it but I must go in a few minutes so it will take some days until release or at last until tomorrow.
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests