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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:24:50+00:00 2026-06-03T04:24:50+00:00

I have this preg_split to split the text after the punctuation marks. $content =

  • 0

I have this preg_split to split the text after the punctuation marks.

$content = preg_split('/(?<=[!?.])./', $content);

Problem 1. Ineed a way to split the text but remove punctuation other that question mark.

How can I do this?

Problem 2. Is there a way to capitalize the words which have more than two letters? Right now I use CSS but text-transform: capitalize does it on every word, even 1 letter words and this makes it look funky on the page. This is why I am thinking of using php to do this.

Ty very much,
Hope you can help!

  • 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-03T04:24:51+00:00Added an answer on June 3, 2026 at 4:24 am

    Problem 1:

    If you need to split on every pontuation marks but can’t replace on question mark, you need to do it in two steps, because preg_replace would replace your question mark too.

    You should split first then replace(by “”) after that.

    Is your regex working as expected ? The first part (?<=) seems weird according to your problem. I guess just /!\?\\./ would do the trick.

    Problem 2:

    I would split your phrases using space then iterate over the resulting array(the words) then checking the size of each word, capitalizing it if it’s size is bigger than 1.

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

Sidebar

Related Questions

I have this simple pattern that splits a text into periods: $text = preg_split(/[\.:!\?]+/,
I have a problem with the function preg_split in php My regexp is #^(-?[0-9]+)(([+x])(-?[0-9]+))*$#
Hi folks I have a block of text which i want to split in
I know this question have been asked endless times but I can't find a
I have a text file I want to read, but exclude lines that contain
I have this simple code to count punctuation in a string. ie there's 2
we have this code: $value = preg_replace(/[^\w]/, '', $value); where $value is in utf-8.
currently, this is the preg_replace string that I have. $mtg_post['post_content'] = preg_replace([^\\x20-\\x7e], ,$ability); This
Have this query: SELECT HOUR( DATE ) AS hr, COUNT( * ) AS cnt
Have this self-made slider: http://jsfiddle.net/wyc3P/4/ What it does: takes min and max values in

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.