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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:21:13+00:00 2026-06-04T17:21:13+00:00

I have 100+ text files containing the text in the following format.. Some Clutter…

  • 0

I have 100+ text files containing the text in the following format..

Some Clutter...
This text file is written by using GuavaSoft Notepad.
some more info
Required Info: some text here, some text here also, a new line
text on another new line, SOME CAPITAL TEXT, one more new line,
some numbers, some punctuation marks,
some completely empty line to follow


some empty lines with tab-spaces, spaces to follow



ok, this is the end of required info..

some more unnecarry lines


empty line

etc
etc

I need to capture/get all the text between “Required Info” and “info..”, spanned on multiple lines.
I am reading all the file into $str.
The regex I have come up is

$pattern = "/Required Info(.+?)info\.\./im";
preg_match($pattern, $str, $matches);
print_r($matches);

Now, this is working at http://rubular.com/r/sP26IahrgI But not at my own Local XAMPP. $matches is just showing empty.
I am very new to RegEx and trying to learn along. Is my Regex expression wrong?

  • 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-04T17:21:14+00:00Added an answer on June 4, 2026 at 5:21 pm

    You need to add the s flag so (.+) will match with newlines too.

    preg_match('/required info(.+)info\.\./is', $str, $m);
    print_r($m);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a CSV file like this: text,0 more text,2 some more text,100 I
I have a text file looks like this : 100 50 20 90 4.07498
I have some data in simplejson format in txt files, which I read using:
I have some XML files of this form: <?xml version=1.0 encoding=utf-8?> <?xml-stylesheet type=text/xsl href=biomirror.xsl?>
I have 100 text files in a directory. The format of the filename is
i have some text files that contain <img width=100 or <img width=1400 or.... How
I have 1 text file containing Ips .Like this iptextfile.txt 10.0.0.1 192.168.1.1 123.123.123.123 And
I have to remove duplicate strings from extremely big text file (100 Gb+) Since
Let's say I have a text file that is 100 lines long. I want
I have a text file containing RGB data for an image, how can I

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.