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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:44:15+00:00 2026-06-17T05:44:15+00:00

My string is: reply-234-private, i want to get the number after reply- and before

  • 0

My string is: “reply-234-private”, i want to get the number after “reply-” and before “-private”, it is “234”. I have tried with following code but it returns an empty result:

$string = 'reply-234-private';
$display = preg_replace('/reply-(.*?)-private/','',$string);
echo $display;
  • 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-17T05:44:16+00:00Added an answer on June 17, 2026 at 5:44 am

    You can just explode it:

    <?php
    $string = 'reply-234-private';
    $display = explode('-', $string);
    
    var_dump($display);
    // prints array(3) { [0]=> string(5) "reply" [1]=> string(3) "234" [2]=> string(7) "private" }
    
    echo $display[1];
    // prints 234
    

    Or, use preg_match

    <?php
    $string = 'reply-234-private';
    if (preg_match('/reply-(.*?)-private/', $string, $display) === 1) {
        echo $display[1];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok i have website, and want to change Leave Reply string near the bottom
This is a weird problem. Here is my code String reply = listen.executeUrl(http://localhost:8080/JavaBridge/reply.php); executeUrl
I want to get the string generated by the WCF service, both synchronously and
Recently I have done this part of code. It does work, but select() works
I have a string of key->value pairs in the following colon-separated format: MIME-Version: 1.0
I have created a string <?xml version='1.0' encoding='ISO-8859-1'?> <response> <content>Question - aa.Reply the option
I have mainString from which i need to get the part of the string
In the following code, findViewById returns null: public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo
I have written this code to check for a particular string from a file.
string in question: '{images:{0:<div style=\\background:red;width:250px;height:250px;display:block;position:absolute;\\></div>}}' I've tried various combinations of single and double quotes.

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.