You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
- 24.NET's implementation has [Balancing Group Definitions msdn.microsoft.com/en-us/library/… which allow this sort of thing.Carl G– Carl G2010-06-13 04:08:34 +00:00Commented Jun 13, 2010 at 4:08
- 50I disagree that regular expressions are the wrong tool for this for a few reasons. 1) Most regular expression implementations have a workable if not perfect solution for this. 2) Often you are trying to find balanced pairs of delimiters in a context where other criteria well suited to regular expressions are also in play. 3) Often you are handing a regular expression into some API that only accepts regular expressions and you have no choice.Kenneth Baltrinic– Kenneth Baltrinic2014-05-02 03:31:42 +00:00Commented May 2, 2014 at 3:31
- 40Regex is the RIGHT tool for the job. This answer is not right. See rogal111's answer.Andrew– Andrew2015-12-26 02:48:27 +00:00Commented Dec 26, 2015 at 2:48
- 12Absolutely agree with the answer. Although there are some implementations of recursion in regexp, they are equal to finite-state machines and are not supposted to work with nested structures, but Context Free Grammars do this. Look at Homsky's hierarcy of Formal Grammars.Nick Roz– Nick Roz2016-04-20 10:52:32 +00:00Commented Apr 20, 2016 at 10:52
- 5Frank is right, Context free grammars cannot be described by regular expressions. That's the key point to this answer.juliccr– juliccr2017-07-18 22:07:21 +00:00Commented Jul 18, 2017 at 22:07
| Show 6 more comments
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
- create code fences with backticks ` or tildes ~ ```
like so
``` - add language identifier to highlight code ```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible) <https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. python-3.x), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you