Looking for a boost regular expression



  • As the title says, I’m looking for a boost regular expression which is unique
    in Npp, meaning, that I’m able to identify whether my matching engine
    actually used boost regex and not something else.



  • @Ekopalypse said in Looking for a boost regular expression:

    As the title says,

    I’m surprised that one came from you. :-) It would surprise me a bit more from @Alan-Kilborn , who is rather vocal about “the title says it all” and similar… but, still, really?

    Unfortunately, though I’m tolerable at regex, I’m not an expert on the nuances on the various regex engines, and don’t know of any data/regex pairs that would match in boost but not in any other regex engine. As much as I hate to send you elsewhere, my recommendation would be to find a group of boost experts and ask there. Then again, I’m not the only regex guy here. (Where are @guy038 and @Terry-R when you need them?)



  • @PeterJones said in Looking for a boost regular expression:

    @Terry-R when you need them?

    I’m here, lurking in the shadows. Unfortunately I’m a one regex engine type. I have ONLY cut my teeth on NPP. I’m aware of the other flavours of regex engines but have not parlayed with them so cannot help sorry.

    Terry



  • I will cut @Ekopalypse slack about “As the title says”. No problems from this camp. :)

    So this might be challenging to find. Something exclusive to Boost. Hmmm. Maybe if it can be narrowed down to knowing how many candidate engines there are it would be easier to find. So is there like two choices, Boost and something else, or…?



  • @Ekopalypse said in Looking for a boost regular expression:

    I’m looking for a boost regular expression which is unique
    in Npp

    I think this would be nearly impossible. If one could get direct access to the boost engine it might be possible but (if I read it all correctly) the engine is included in the Scintilla system which is in turn used by NPP. It would depend on how each layer responds to the regex presented.

    I suppose the question comes from the possibility of including a different regex engine in Scintilla and wanting to know which one is operational. As for @Alan-Kilborn question of how many, Wikipedia lists approximately 30, I dont know how many are compatible with inclusion to Scintilla. Then there will be versioning issues where a later version may well expand on the regex possibilities. It would be like hitting a moving target!

    If the question is indeed which one Scintilla is using then perhaps a call to one of the MANY scintilla commands might elicit the answer?
    https://www.scintilla.org/ScintillaDoc.html#BuildingScintilla
    has right at the bottom some references to alternative regex engines when compiling.

    Terry



  • @PeterJones, @Terry-R , @Alan-Kilborn,

    @Alan-Kilborn

    I will cut @Ekopalypse slack about “As the title says”.

    deepL doesn’t translate this correctly, I guess.
    It returns something like
    Ich werde @Ekopalypse mit “Wie der Titel sagt” aufhören.
    I hope it is nothing which makes me feel more feminine after you cut … :-D

    First of all thank you for participating and now you see how desperate I am. :-)
    I was hoping that one found a regex pattern already,
    which seems to work for boost::regex but not, or not for many, others.

    The single open point about migrating everything from PythonScript to my python3 based plugin
    is the research and rereplace functions which do use the boost::regex engine instead of the python re module.

    Now I guess this is solved as well and I wanted to know for sure if this is really the case
    or if something else, namely the C11-Regex Engine, is jumping in.

    I cannot test against the PythonScript functions because I think I’m using the
    exact version\configuration Npp uses and in the past we found out that
    there are differences so I can’t trust the result.

    @Terry-R, thx for the idea but scintilla doesn’t offer a way
    to identify which Regex engine is used, at least I haven’t found one.

    @PeterJones, I searched stackoverflow but found nothing and it looks
    there is no boost::regex mailing list but maybe asking on stackoverflow
    could be helpful - I should give it a try.

    I guess the first step is to check C11 Regex to see whether it supports the
    same features as boost does with the same syntax.



  • @Ekopalypse said in Looking for a boost regular expression:

    namely the C11-Regex Engine

    So there we have it, narrowed down to two: Boost or C11.

    Maybe there are some hints for you here:

    ...you can use boost::regex instead of std::regex. While std::regex ... defines pretty much the same operations and classes as boost::regex, there are a number of important differences in the actual regex flavor.
    

    if something else … is jumping in

    Obviously you are much closer to what you are doing, but I’m confused about how something like this can “jump in”, without you as the developer know what is going on.

    Good luck.



  • @Alan-Kilborn

    Scintilla states

    Building with an alternative Regular Expression implementation
    A simple interface provides support for switching the Regular Expressions engine at compile time. You must implement RegexSearchBase for your chosen engine, look at the built-in implementation BuiltinRegex to see how this is done. You then need to implement the factory method CreateRegexSearch to create an instance of your class. You must disable the built-in implementation by defining SCI_OWNREGEX.

    and now I’m asking myself, if I do a SearchInTarget with the flag SCFIND_REGEXP set, does that mean I’m using already the engine npp uses
    or is it the one scintilla offers (afaik, an C11 implementation).

    I tend to believe that SearchInTarget uses the boost::regex engine instead
    of its own implementation because npp uses SCI_OWNREGEX.
    Just want to be sure.



  • Maybe this reference helps.



  • Following @MAPJe71 's lead, it seems like the table here has some nice differentiators between Boost and “std::regex in C++11”, if that is what is meant above by “C 11” (which I presume it is).



  • @MAPJe71 , @Alan-Kilborn

    yes, that is helpful - thank you very much.


Log in to reply