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 6644555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:10:52+00:00 2026-05-26T00:10:52+00:00

I have a file which has text like this: #1#14#ADEADE#CAH0F#0#0….. I need to create

  • 0

I have a file which has text like this:

#1#14#ADEADE#CAH0F#0#0.....

I need to create a code that will find text that follows # symbol, store it to variable and then writes it to file WITHOUT # symbol, but with a space before. So from previous code I will get:

1 14 ADEADE CAH0F 0 0......

I first tried to did it in Python, but files are really big and it takes a really huge time to process file, so I decided to write this part in C++. However, I know nothing about C++ regex, and I’m looking for help. Could you, please, recommend me an easy regex library (I don’t know C++ very well) or the well-documented one? It would be even better, if you provide a small example (I know how to perform transmission to file, using fstream, but I need help with how to read file as I said before).

  • 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-26T00:10:52+00:00Added an answer on May 26, 2026 at 12:10 am

    This looks like a job for std::locale and his trusty sidekick imbue:

    #include <locale>
    #include <iostream>
    
    
    struct hash_is_space : std::ctype<char> {
      hash_is_space() : std::ctype<char>(get_table()) {}
      static mask const* get_table()
      {
        static mask rc[table_size];
        rc['#'] = std::ctype_base::space;
        return &rc[0];
      }
    };
    
    int main() {
      using std::string;
      using std::cin;
      using std::locale;
    
      cin.imbue(locale(cin.getloc(), new hash_is_space));
    
      string word;
      while(cin >> word) {
        std::cout << word << " ";
      }
      std::cout << "\n";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a java ee project which has a text file that uses a
Supposedly I have this line in my text file which has the following format.
So I have a a text file that looks something like this: public >ret
I have a text file which has the following structure: 341|18 Hello world|20090225230048AAnhStI|90|$0.30|10|289|2|2|2|Is that
I have a text file, which looks like this: node13 state = free np
I have an XML file which has many section like the one below: <Operations>
I have a php file which has a require_once Statement (?) this file is
I have a very large XML file which has like 40000 data, and when
I have a class and inside that class is this function which has a
We have one text file which has the following text "\u5b89\u5fbd\u5b5f\u5143" When we read

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.