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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:45:19+00:00 2026-05-25T06:45:19+00:00

$string = WORD is the first HEJOU is the Second BOOM is the Third;

  • 0
$string = "WORD is the first HEJOU is the Second BOOM is the Third";
$sring = str_replce('???', '???<br>', $string);
echo $string; // <br>WORD is the first <br>HEJOU is the Second <br>BOOM is the Third

Well the illustration speaks for itself. I want to select all words with capital letters (not words that start with capital letter) and replace with something in front of it. Any ideas?

  • 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-25T06:45:20+00:00Added an answer on May 25, 2026 at 6:45 am
    $string = "WORD is the first HEJOU is the Second BOOM is the Third";
    $string = preg_replace("#\b([A-Z]+)\b#", "<br>\\1", $string);
    echo $string;
    

    OUTOUT
    <br>WORD is the first <br>HEJOU is the Second <br>BOOM is the Third

    The regular expression being used says:

    \b - Match a word boundary, zero width
    [A-Z]+ - Match any combination of capital letters 
    \b - Match another word boundary
    ([A-Z]+) - Capture the word for use in the replacement
    

    Then, in the replacement

    \\1, replace with the captured group.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to extract the first word of a variable from a string. For
I want to split a string into two variables, the first word and the
I want the first word of the string to be surrounded by tags. Insted
I want to match the first number/word/string in quotation marks/list in the input with
string temp is equal to ZERO:\t.WORD\t1 from my debugger. (the first line of my
I have a string pc1|pc2|pc3| I want to get each word on different line
We have this string: according to posts #4,#5 and #6 the word... I want
I need to grab first word in string and I need to convert it
Let's say that I have a two word string and I want to capitalize
How do retrieve the first word of a string in C++? For example, abcde

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.