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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:08:30+00:00 2026-06-03T02:08:30+00:00

I have this specific line of text and clients submit, and the line automatically

  • 0

I have this specific line of text and clients submit, and the line automatically breaks at 65 characters and i need to modify my regular expression to look for one more additional line, return carriages or new line characters up until the first punctuation mark such as .,!,?

An example of the line being matched.:

Snippet: It's time again for the Annual State Marching Event, This Saturday at 5pm.

The above line exceeds 65 characters, and sometimes the lines are broken like this

Snippet: It's time again for the Annual State Marching Event, This 
Saturday at 5pm.

Which appears as Event, This\r\n
This is the regexp i use:

preg_match('/Snippet:(\s)?+(.*)\./i', $html_part, $matches) ? $matches[2] : '';

I’ve tried on my won to escape the punctuation marks, but no luck.
Any help would be appreciated. Thanks in advance.

  • 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-03T02:08:31+00:00Added an answer on June 3, 2026 at 2:08 am

    Try the s modifier, like so:

    /Snippet:(\s)?+(.*)\./is
    

    If this modifier is set, a dot metacharacter in the pattern matches
    all characters, including newlines. Without it, newlines are excluded.
    This modifier is equivalent to Perl’s /s modifier. A negative class
    such as [^a] always matches a newline character, independent of the
    setting of this modifier.

    Source

    Demo

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

Sidebar

Related Questions

I have a 30000 plus line text file that I need to modify using
I have this long list of checkboxes with specific labels that look something like
I have this long list of checkboxes with specific labels that look something like
is it possible to have specific text in a listbox line to act like
I have a text view with multiple lines of text e.g. This is line
i have this specific question to do to you, i have a database from
I have this code to move my uploaded file to a specific directory: if
I have this chart in which if any point in graphs exceeds specific limit
I have this function which pings my server for a specific change in data:
i have this code that will check the array contains the specific string 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.