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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:33:20+00:00 2026-05-28T13:33:20+00:00

Given a string like this: Seat 2: Pet21 ($1.98 in chips) In php you

  • 0

Given a string like this:

Seat 2: Pet21 ($1.98 in chips) 

In php you can select a part of a regex using parentheses in your regex, like this:

Seat ([0-9]+): (.{1,12}) .[$|€|£]([0-9]+\.?[0-9]{0,2}) in chips.

This selects the seat number, user id and the amount of chips:

Array
(
    [0] => Array
        (
            [0] => Seat 1: S@pphiR ($0.83 in chips)
            [1] => Seat 2: Pet21 ($1.98 in chips)
            [2] => Seat 3: derphurp ($2.76 in chips)
            [3] => Seat 4: -M-A-R-K-qaz ($0.92 in chips)
            [4] => Seat 5: Rolle55 ($2.45 in chips)
            [5] => Seat 6: SanderDecler ($2 in chips)
        )

    [1] => Array
        (
            [0] => 1
            [1] => 2
            [2] => 3
            [3] => 4
            [4] => 5
            [5] => 6
        )

    [2] => Array
        (
            [0] => S@pphiR
            [1] => Pet21
            [2] => derphurp
            [3] => -M-A-R-K-qaz
            [4] => Rolle55
            [5] => SanderDecler
        )

    [3] => Array
        (
            [0] => 0.83
            [1] => 1.98
            [2] => 2.76
            [3] => 0.92
            [4] => 2.45
            [5] => 2
        )

)

Is there a way to do the similar in objective-c with NSRegularExpression

edit: So far I’ve got this:

    NSRegularExpression *regex = 
    [NSRegularExpression regularExpressionWithPattern:@"Seat [0-9]+: (.{1,12}) .[$|€|£][0-9]+\.?[0-9]{0,2} in chips."
                                              options:0 
                                                error:nil];

    for (NSTextCheckingResult *result in [regex matchesInString:history options:NSMatchingReportCompletion range:NSMakeRange(0, history.length)]) 
    {

    }
  • 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-28T13:33:21+00:00Added an answer on May 28, 2026 at 1:33 pm

    You probably want to use the firstMatchInString:options:range: method of NSRegularExpression, which returns an NSTextCheckingResult. Then you want to use the rangeAtIndex: method of NSTextCheckingResult to get the range of each submatch. You can pass a range to the substringWithRange: method of the original NSString to get the text of a submatch.

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

Sidebar

Related Questions

given an xml string like this: <some><nested><xml>value</xml></nested></some> what's the best option (using ruby) to
-- Given a CSV string like this: declare @roles varchar(800) select @roles = 'Pub,RegUser,ServiceAdmin'
Given a string like this: a,string, with,various,values, and some,quoted What is a good algorithm
Given a UTC time string like this: 2005-11-01T00:00:00-04:00 What is the best way to
Given a string like so: Hello {FIRST_NAME}, this is a personalized message for you.
Given a struct like this: public struct SomeStruct { public SomeStruct(String stringProperty, Int32 intProperty)
Given a string like String a=- = - - What is your name?; How
Given an HTML string like: <span class=findme id=31313131313>The Goods</span> What kind of REGEX in
In most languages like C# for example given a string you can test (boolean)
Given a string like this: <a href=http://blah.com/foo/blah>This is the foo link</a> ... and a

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.