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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:49:37+00:00 2026-06-13T08:49:37+00:00

Suppose you want to do regular expression search and extract over a pipe, but

  • 0

Suppose you want to do regular expression search and extract over a pipe, but the pattern may cross multiple lines, How to do it? Maybe a regular expression library work for a stream?

I hope do this job using Python library? But any solution will be OK, a library not a cmd line tool of course.

BTW, I know how to solve my current problem, just seeking a general solution.

If no such libray exists, why regular library can not work with stream given the regular mathing algorithm never need backward scaning.

  • 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-06-13T08:49:38+00:00Added an answer on June 13, 2026 at 8:49 am

    If you are after a general solution, your algorithm would need to look something like:

    1. Read a chunk of the stream into a buffer.
    2. Search for the regexp in the buffer
    3. If the pattern matches, do whatever you want with the match, discard the start of the buffer up to match.end() and go to step 2.
    4. If the pattern does not match, extend the buffer with more data from the stream

    This could end up using a lot of memory if no matches are found, but it is difficult to do better in the general case (consider trying to match .*x as a multi-line regexp in a large file where the only x is the last character).

    If you know more about the regexp, you might have other cases where you can discard part of the buffer.

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

Sidebar

Related Questions

Suppose I have these line: /path-to-something/section/resource?var=name /path-to-something/section/resource I want to use regular expression to
Suppose I want a regular expression that matches both Sent from my iPhone and
I need to perform a regular expression search for a string x in another
I'm trying to extract every HTML tag including a match for a regular expression.
I am new to regular expressions. I want to do multiline search. Here is
Suppose the source string is (Adam)/NNP Apple/NN Orange/NN banana/NN tall/JJ My regular expression is
I have made this regular expression which does exactly what I want when I
Suppose I want to add two buffers and store the result. Both buffers are
Suppose I want to store N samples (each sample takes up a significant portion
Suppose I want to have a blog with Rails 3 on my website and

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.