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

  • Home
  • SEARCH
  • 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 7670399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:48:50+00:00 2026-05-31T15:48:50+00:00

So I have this string [14:42:49] Any Nick Name: Message bla bla and the

  • 0

So I have this string [14:42:49] Any Nick Name: Message bla bla and the only thing I want is Any Nick Name.

I was never really good at regex and I can’t remember how to get a specific part of the result. I came this far: /\[([0-9]{2}(:|\])){3} (.+):/g resulting in [14:42:49] Any Nick Name:.

Well sure I could remove the last and first part with substr and so on, but isn’t there an easier way ?

  • 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-31T15:48:51+00:00Added an answer on May 31, 2026 at 3:48 pm

    Your regexp is almost correct.

    var regexp = /^\[\d{2}:\d{2}:\d{2}\] (.+):/;
    

    This matches [xx:xx:xx] something: with x being digits. The ^ means that the string should start there, and \d means a digit. The g flag doesn’t add anything here.

    Use .exec, and use [1] to get the first group (the characters matched inside the parens):

    regexp.exec("[14:42:49] Any Nick Name: Message bla bla")[1];
    // "Any Nick Name"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this string: test1__test2__test3__test4__test5__test6=value There could be any number of test-keys. I want
I have a string stack+ovrflow*newyork; i have to split this stack,overflow,newyork any idea??
I have this string in PHP: $string = name=Shake & Bake&difficulty=easy; For which I
I have this string stored in a variable: IN=bla@some.com;john@home.com Now I would like to
We have this string: according to posts #4,#5 and #6 the word... I want
I have this string: %{Children^10 Health sanitation management^5} And I want to convert it
I have this string s that is formatted in this way. I want to
I have this string: [a [a b] [c e f] d] and I want
i have this string string = <p>para1</p><p>para2</p><p>para3</p> I want to split on the para2
I have this string: image/fewe that I want to replace with something else, but

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.