Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4071600
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:46:41+00:00 2026-05-20T16:46:41+00:00

I seek more knowledge of ones mind again. I have a C++ solution which

  • 0

I seek more knowledge of ones mind again.

I have a C++ solution which uses the Boost libraries as the solution requires to work within a Linux enviroment. However my knowledge is within C# and C++ is a somewhat new area of mine which I’ve dived into.

I’m looking for an example use of how I could create a somewhat template and replace the values via regex?

Here’s an example of what I’m talking about:

<VirtualHost *:80>
    ServerName  {$1}.somedomain.com
    ServerAlias {$1}
    ServerAdmin mr.admin@somedomain.com

    <Location />
        DAV svn
        SVNPath /some/dir/{$2}/{$3}/{$4}
        AuthType Basic
        AuthName "{$5}"
        AuthUserFile /some/dir/{$2}/{$3}/{$4}/{$4}.users
        Require valid-user
    </Location>
</VirtualHost>

And a key of the values:
{ Already formatted, just require to be replaced with the $n’s }

$1 = sub domain alias (3 characters long)
$2 = is either "public" or "private"
$3 = a users username (no more than 25 characters)
$4 = the svn project name (no more than 30 characters and " " replaced with "_")
$5 = the actual repository name given by the user.

Ideally a function/method will be able to handle this so I can just pass say a repository object through then render it via that.

Many thanks,
Shaun

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T16:46:42+00:00Added an answer on May 20, 2026 at 4:46 pm

    Actually, you don’t need the power of regular expressions, you can do with find/replace.

    void replaceall(string& source, const string& pattern, const string& replacement)
    {
        int curr = 0;
        while ((curr = str.find(pattern, curr)) != string::npos)
            str.replace(curr, parrern.length(), replacement);
    }
    
    void substitutetemplate(
            const string& subDomainAlias,
            bool publicOrPrivate,
            const string& userName,
            const string& svnProjectName,
            const string& repositoryName)
    {
        string result = m_template;
    
        replaceall(result, "{$1}", subDomainAlias);
    
        string pop = publicOrPrivate ? "public" : "private";
        replaceall(result, "{$2}", pop);
    
        replaceall(result, "{$3}", userName);
    
        string svnProjectNameWithoutSpaces = svnProjectName;
        replaceall(svnProjectNameWithoutSpaces, " ", "_");
        replaceall(result, "{$4}", svnProjectNameWithoutSpaces);
    
        replaceall(result, "{$5}", repositoryName);
        m_result = result;
    }
    

    m_template should be a big string containing the whole template with linebreaks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

More specifically, I have a multithreaded command line Java application which runs and collects
Which implementation of bzip2 have the biggest decompression speed? There is a http://bitbucket.org/james_taylor/seek-bzip2/src/tip/micro-bunzip.c which
I would like seek some guidance in writing a process profiler which runs in
I am using MFC CFile Seek function. I have a problem about Seek out
The following query uses an index seek on an index on the LastModifiedTime column.
I have a large raw data file (up to 1GB) which contains raw samples
I want to do relative seek on a mysql resultset, more specifically +1/-1 seeks.
Having recently worked on a project which required some more IO interaction than I'm
I have a small database that requires multiple table queries to retrieve data. I
I have contacts that can be in more than one group and have more

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.