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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:02:46+00:00 2026-06-15T00:02:46+00:00

i have this string [111] Test Team +3½-110 and i my expected out is

  • 0

i have this string

[111] Test Team +3½-110

and i my expected out is this

team : Test Team,
bet : +3½-110

how can i do that in jquery?

TIA

  • 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-15T00:02:48+00:00Added an answer on June 15, 2026 at 12:02 am

    You wouldn’t use jQuery for this (nor is the “json” tag appropriate), you’d use standard JS string manipulation functions (with or without regex).

    I’ll assume the rule for splitting up your string is to ignore any leading value in square brackets, then take everything up to the + as the team name and everything after the + (including the + itself) as the bet. If there’s more than one + then all but the last will be considered part of the team name.

    function formatBet(input) {
        return input.replace(/^(\[[^\]]*\] )?(.+)( \+[^+]+)$/,"team: $2, bet:$3");
    }
    
    console.log(formatBet("[111] Test Team +3½-110"));
         // logs "team: Test Team, bet: +3½-110"
    console.log(formatBet("Test Team +3½-110"));   
         // logs "team: Test Team, bet: +3½-110"
    console.log(formatBet("[111] Test + Team +3½-110"));
         // logs "team: Test + Team, bet: +3½-110"
    console.log(formatBet("[111] Whatever +3½-110"));
         // logs "team: Whatever, bet: +3½-110"
    

    Demo: http://jsfiddle.net/LKJjw/

    In my regex:

    ^(\[[^\]]*\] )?
    

    …optionally matches at the beginning of the string a [ followed by zero or more non-] characters followed by ] and a space. Then:

    (.+)
    

    …matches the team name – one or more of any character. Then:

    ( \+[^+]+)$
    

    …matches a space followed by a +, followed by one or more non-+ characters at the end of the string.

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

Sidebar

Related Questions

I have string like this: 1112222355. How can I get array like that [111,2222,3,55]
I have this c# code that builds a string of comma seperated matches for
I have a string like: '11,111' and I would like to get this as
i have this JSON string that i want to decode it with json_decode(); function
I have a string that comes in this format Transaction 'pqr_111_xyz_222(Aaaa Bbbb Cccc -
Say i have a string as follows ' *my test string 1 111:222:444: &
Lets say you have strings of this format. January 11th, 111 November 1st, 1101
I have this string 2012-06-27 16:17:06 and I want to convert it to GMT
I have this String String criteria=ESS.(BVA4+BVA5)+(-(DIESE.(BVM5+BVM6))); I want to put validations on it. It
I have this string in php i want to skip the ppattern ------------------------------------------ FROM:Andy;

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.