Skip navigation
Currently Being Moderated

Boost regex not working inside indesign plugin

Apr 2, 2012 4:02 AM

Tags: #regex #boost

Hi, While i was writing the below code in a separate project inside visual studio express, It works fine!

Now when I am using the same code in a Adobe InDesign plugin then boost::regex_search fails..


I am not getting the exact reason...

Any idea for resolving this will be great help.


void MTSTestFunctions::ParseAllMarker(std::wstring& inText, std::vector &outMarkerInfoVec)


    std::wstring::const_iterator start = inText.begin();

    std::wstring::const_iterator end = inText.end();


    boost::wregex pattern(L"((<.*?>)|(\\[[^[].*?[^]]\\])|(\\[\\[.*?\\]\\]))");

    boost::wsmatch what;

    boost::match_flag_type flags = boost::match_default;

    int32 index = 0;



        while(boost::regex_search(start, end, what, pattern, flags))


            MarkerInfo tmpMarkerInfo;


            tmpMarkerInfo.mStartIndex = (what.position() + index);

            index += what.position();

            tmpMarkerInfo.mEndIndex = (index += what.position());

            tmpMarkerInfo.mMarkerTextLength = (index + what.length());

            index += what.length();


            // update search position:

            start = what[0].second;


            // update flags:

            flags |= boost::match_prev_avail;

            flags |= boost::match_not_bob;



    catch(std::runtime_error ex)






  • Currently Being Moderated
    Apr 4, 2012 1:38 PM   in reply to dvkkk

    What library are you using?


    I'm too lazy to dig for a Windows machine right now, but on a Mac I took ID6SDK/build/mac/debug/packagefolder/contents/macos/libboost_regex-mt -d-1_34_1.dylib or the equivalent for later versions.



    Mark as:
  • Currently Being Moderated
    Apr 6, 2012 5:47 AM   in reply to dvkkk

    Yes, Windows is a problem.

    Just kidding.


    Use the dll provided by InDesign, or if you really need a different version for compatibility with prebuilt external libraries, make sure that you don't call InDesign's methods and InDesign does not call yours and those of any third library. E.g. you isolate the code into a separate dll and ensure that the linker does not import or export any questionable symbols. On the Mac I'd use otool and nmedit for that.



    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points