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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:17:50+00:00 2026-06-11T08:17:50+00:00

Working on pure-ruby implementation of XCode project file parser, PBXProject , and need little

  • 0

Working on pure-ruby implementation of XCode project file parser, PBXProject, and need little help with regex.

So the PBXProject file has bunch of weird coed lines, which mixed contents. What I have now is regex, (.*?) = (.*?)( \/\* (.*) \*\/)?; ? which works on simpler cases (first line). But for second line, it cuts too early (to first ; -character).

isa = PBXBuildFile; fileRef = C0480C2015F4F91F00E0A2F4 /* zip.c */;

isa = PBXBuildFile; fileRef = C0480C2315F4F91F00E0A2F4 /* ZipArchive.mm */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; };

So what I want out of those lines are simple name = value pairs, i.e.

isa = PBXBuildFile
settings = {COMPILER_FLAGS = "-fno-objc-arc"; }

Easy way to achieve this with one regex?

  • 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-11T08:17:52+00:00Added an answer on June 11, 2026 at 8:17 am

    This regex will work just fine:

    [a-zA-Z0-9]*\s*?=\s*?.*?(?:{[^}]*}|(?=;))
    

    Note that only one level of brackets is allowed, the regex will not process nested brackets.

    From your example, the following lines will be catched:

    isa = PBXBuildFile
    fileRef = C0480C2015F4F91F00E0A2F4 /* zip.c */
    isa = PBXBuildFile
    fileRef = C0480C2315F4F91F00E0A2F4 /* ZipArchive.mm */
    settings = {COMPILER_FLAGS = "-fno-objc-arc"; }
    

    Here’s the explanation of regex:

    [a-zA-Z0-9]*\s*?=\s*?.*?(?:{[^}]*}|(?=;))
    
    Options: ^ and $ match at line breaks
    
    Match a single character present in the list below «[a-zA-Z0-9]*»
        Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»
        A character in the range between “a” and “z” «a-z»
        A character in the range between “A” and “Z” «A-Z»
        A character in the range between “0” and “9” «0-9»
    Match a single character that is a “whitespace character” (spaces, tabs, and line breaks) «\s*?»
        Between zero and unlimited times, as few times as possible, expanding as needed (lazy) «*?»
    Match the character “=” literally «=»
    Match a single character that is a “whitespace character” (spaces, tabs, and line breaks) «\s*?»
        Between zero and unlimited times, as few times as possible, expanding as needed (lazy) «*?»
    Match any single character that is not a line break character «.*?»
        Between zero and unlimited times, as few times as possible, expanding as needed (lazy) «*?»
    Match the regular expression below «(?:(?={){[^}]*}|(?=;))»
        Match either the regular expression below (attempting the next alternative only if this one fails) «(?={){[^}]*}»
            Match the character “{” literally «{»
            Match any character that is NOT a “}” «[^}]*»
                Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»
            Match the character “}” literally «}»
        Or match regular expression number 2 below (the entire group fails if this one fails to match) «(?=;)»
            Assert that the regex below can be matched, starting at this position (positive lookahead) «(?=;)»
                Match the character “;” literally «;»
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working an project (pure hobby, Sharping my skills) which has one unified back-end
I'm currently working on a pure html 5 canvas implementation of the flying tag
i'm working on some website that has a section with pure AJAX, but i
I am currently working on a project to create simple file uploader site that
I am currently working on a pure css multilevel drop-down menu and I cannot
Working on the problems on Project Euler to try to learn Clojure. I'm on
I've been working on a piece of software where I need to generate a
I am working with win32 API and my language of choice is pure C
All, Working on a custom TCP/IP server for a text-based multiplayer game, using Ruby.
I’m working in a pure iOS5/ARC environment, so I can use __weak references as

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.