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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:39:07+00:00 2026-05-30T04:39:07+00:00

I have a string abc@123 (hello world) posted 23 July 1990 20:34:00 +000 .

  • 0

I have a string abc@123 (hello world) posted 23 July 1990 20:34:00 +000. I want output as hello world abc (abc@123) posted "on" 23 July 1990 "at" 20:34:00 Should it be done with explode or preg() function??

  • 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-30T04:39:08+00:00Added an answer on May 30, 2026 at 4:39 am

    I’d use a regex with preg_replace, here is an example that can likely be improved upon:

    $str = 'abc@123 (hello world) posted 23 July 1990 20:34:00 +000';
    echo preg_replace( '/([A-Za-z]+)@(\d+) \(([A-Za-z ]+)\) posted (\d+ [A-Za-z]+ \d+) (\d+:\d+:\d+) .*/', '$3 $1 ($1@$2) posted "on" $4 "at" $5', $str);
    

    Output:

    hello world abc (abc@123) posted “on” 23 July 1990 “at” 20:34:00

    Demo

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

Sidebar

Related Questions

I have a list of string like: s = [(abc,bcd,cde),(123,3r4,32f)] Now I want to
I have a simple string: data1:abc,123,xyz,data2:hello,goodbye I need regex to return a match collection
I have a string array: array = ['123';'abc';'uvw']; I want convert it to a
Specifically, say I have a string like ABC-123-NNN. I would like the paragraph to
I have a string like this: Please refer to document ABC.123.1234.1234 and document CBA.321.4321
I have a string like: This is my abc.def ght.123 example 12.34 test I'd
I have a string: s=123--abc,123--abc,123--abc I tried using Ruby 1.9's new feature named groups
Assuming I have a string $str = "abc*efg*hij*"; and an array $arr = array("123","456","789");
I have strings like this : ABC/ABC/123, ABC/ABC/123/567, ABC/123 And I want to search
I have the following string (the double quotes are part of the string): abc

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.