top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Utility to locate errors in regular expressions

+1 vote

Finding out why a regular expression does not match a given string can very tedious. I would like to write a utility that identifies the sub-expression causing the non-match. My idea is to use a parser to create a tree representing the complete regular expression. Then I could simplify the expression by dropping sub-expressions one by one from right to left and from bottom to top until the remaining regex matches.
The last sub-expression dropped should be (part of) the problem.

As a first step, I am looking for a parser for Python regular expressions, or a Python regex grammar to create a parser from.

But may be my idea is flawed? Or a similar (or better) tools already exists? Any advice will be highly appreciated!

posted May 24, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes


it shows the subexpressions which cause the match by coloring the parts. Not exacty what you want, but very intuitive and powerful. Beware this is Tcl and there might be subtle differences in RE syntax, but largely
it's the same.

answer May 24, 2013 by anonymous
Similar Questions
+1 vote

I got the following regular expression:


Basically I want to extract a value between = and " (example: "City=Paris", output "Paris"). But for some reason this expression wont work in PowerCenter.

You got any idea how to implement it?

Thank you

0 votes

I have table names in this form:


I am trying to create a regular expression that will return true for only these tables:


I tried these:

pattern = re.compile(r"_(?!(CTL|DEL|RUN))")pattern = re.compile(r"w+(?!(CTL|DEL|RUN))")
pattern = re.compile(r"(?!(CTL|DEL|RUN)$)")

But, both match.I do not need to capture anything.

+2 votes

You are given two processes and each process is having four threads. One of the thread is having performance issue. How will you find out that thread which is having problem.

+3 votes

There is a 8 x 8 standard chess board. How many minimum bits one requires to locate both kings in the board at any point of time?