Linked Questions
24 questions linked to/from Is it possible to match nested brackets with a regex without using recursion or balancing groups?
1 vote
2 answers
145 views
Java Regex to keep character but only when used inside expression [duplicate]
Example: This is a text [Java [Script]] [Programming] Expected output: group 1: Java [Script] group 2: Programming What I tried: \[([^\[\]]*?)\] which gives me two groups but the groups are: group ...
-1 votes
1 answer
164 views
How to ignore repeating regex pattern [duplicate]
I was not sure how to phrase the title of this question, but imagine i have the following string: (1,2),(3,(4)) I want a regex that allows me to get 1,2 and 3,(4) The regex I currently have is \\(([^)]...
0 votes
0 answers
109 views
How to find strings outside of parethesis [duplicate]
I read the question and answer and this is not a duplicate. I would like to find all comma and split the string by them which are outside of all parenthesis. Consider the following string abc(def(100,...
0 votes
1 answer
78 views
Regex for Delimeter [duplicate]
I am trying to write a regex for delimiters “(“, “)”, “,”. I tried to write a regex but it is not the correct for the delimeters. Let's say the input is mult(3,add(2,subs(4,3))). The output with my ...
2356 votes
36 answers
4.0m views
RegEx match open tags except XHTML self-contained tags
I need to match all of these opening tags: <p> <a href="foo"> But not self-closing tags: <br /> <hr class="foo" /> I came up with this and wanted to make ...
454 votes
23 answers
534k views
Regular expression to match balanced parentheses
I need a regular expression to select all the text between two outer brackets. Example: START_TEXT(text here(possible text)text(possible text(more text)))END_TXT ^ ...
52 votes
1 answer
221k views
Reference - What does this regex mean?
What is this? This is a collection of common Q&A. This is also a Community Wiki, so everyone is invited to participate in maintaining it. Why is this? regex is suffering from give me ze code type ...
59 votes
7 answers
4k views
"vertical" regex matching in an ASCII "image"
Note: This is a question about possibilities of modern regex flavors. It's not about the best way to solve this using other methods. It's inspired by an earlier question, but that one is not ...
17 votes
2 answers
24k views
How to match string within parentheses (nested) in Java?
I would like to match a string within parentheses like: (i, j, k(1)) ^^^^^^^^^^^^ The string can contain closed parentheses too. How to match it with regular expression in Java without writing a ...
11 votes
4 answers
1k views
Regular Expression for separating strings enclosed in parentheses [duplicate]
I have a String that contains 2 or 3 company names each enclosed in parentheses. Each company name can also contains words in parentheses. I need to separate them using regular expressions but didn't ...
1 vote
3 answers
2k views
RegEx for parsing CSV that contains JSON in a "column"
I need to parse a comma separated text file where a line can contain a json as column value. The file also contains a header row. I am trying to build a regular expression, so that I can parse the ...
0 votes
1 answer
591 views
Regular expression for Syntax parser in Java
I need a regular expression for a Java syntax parser that matches my programming language syntax that look like this: Variable1={1,2,3} Variable2=Variable1+{4,5,6}+{}*{2} Variable3=(Variable2+{1})*...
2 votes
2 answers
206 views
Backref before associated group
In an extended regular expression, with backrefernces, is it valid to have a backreference before the associated group? For example, does the pattern \1(a) make sense and what does it match?
2 votes
1 answer
246 views
Regex ignoring matches between square brackets
Hi I'm trying to create a Regex to help separate a string into a series of object fields, however having issues where the individual field values themselves are lists and therefore comma separated ...
0 votes
1 answer
163 views
java regexp for nested parenthesis
Consider the following java String: String input = "a, b, (c, d), e, f, (g, (h, i))"; Can you help me to find a java regexp to obtain its 6 parts: a b (c,d) e f (g, (h,i)) That were obtained from ...