Regular Expressions

Hello,
I would like to know what you use for a Regular Expression tool?  I'm not asking about an editor, but some type of "expression test tool."  I can google for such app, and read;
http://www.bastian-bergerhoff.com/eclipse/features/web/QuickREx/toc.html 
http://www.bastian-bergerhoff.com/eclipse/features/web/QuickREx/standalone.html#why

Yet allow me to ask; is there a better tool, or the best tool?
chimaAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
peprConnect With a Mentor Commented:
It depends. If you use Eclipse as your Python IDE (e.g. http://www.vogella.com/articles/Python/article.html), then using QuickREx may be the good choice. If you do not use Eclipse, then it can be a complication for you.

It also depends on what you mean by the expression test tool. For testing a single expression with several sentences, you can use a separate Python script that simply prints the result. If you want to have the collection of tests that check whether the development of the regular expression patterns did not break the previous functionality, then the QuickREx will not help you that much.

You cannot build a regular expression if you do not understand what it really does (or estimate what it should do, in advance). The trial/failure approach would take too much time. I personally would choose a separate, simple Python script or the unittest approach for more extensive testing.
0
 
user_nConnect With a Mentor Commented:
Regular expresions are diferent for diferent programing languages
0
 
chimaAuthor Commented:
user_n, really! now that's a pain.  Okay, for Python then.
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
peprCommented:
Regular expressions are the way of expressing programs that accept the tested strings. They are a kind of programs where the code (the pattern string) is compiled into the form of so called automaton. This way, one can think also of regular languages See the Noam Chomski hierarchy and the basics of formal grammars (http://en.wikipedia.org/wiki/Chomsky_hierarchy).

From that perspective, it is difficult to think about a general tool that would test your regular expression.

However, you can use the approach used for testing programs. Simply said, you can create the set of strings that will be used for testing of your regular expression. The testing function will produce the boolean result that says whether the regular expression behaves the expected way.

When the approach is used for testing the functionality of fragments of bigger code (of the functions, procedures), it is called unit testing (http://en.wikipedia.org/wiki/Unit_testing). When you define the wanted behaviour in the form of tests first, and only then you start to implement the solution, then the approach is called test-driven development (http://en.wikipedia.org/wiki/Test_driven_development).

To summarize, you may want to use the unit test framework that is available in Python as the standard module (http://docs.python.org/2/library/unittest.html).

There is the chapter in "Dive Into Python 3" explicitly focused to creating the regular expressions (http://getpython3.com/diveintopython3/regular-expressions.html), and a separate chapter is devoted to unit testing -- shown on testing the regular expressions built in the earlier chapter (http://getpython3.com/diveintopython3/unit-testing.html). The book itself is nicely written, not using big words, explaining what you need to know.
0
 
ozoConnect With a Mentor Commented:
Regular expressions are the way of expressing programs that accept the tested strings
Not really, regular expressions express the set of strings the set of strings to be accepted, but say nothing about the program that accepts them.
There can be many different algorithms for accepting the set of strings specified by a regular expression, and many different programs implementing those algorithms.
0
 
peprCommented:
@ozo: There is the data/code duality when programming. The strings expressed via regular expressions can only be accepted by some program that implements the detection, right? The implementations may differ, but should not we start from the basics? And the efficient implementation is based on a final automaton.
0
 
chimaAuthor Commented:
pepr and ozo, while I appreciate your comments, and some good knowledge became of your comments, I feel that we got off the question.  I was/am in search of other Regular Expression tools like QuickREx, see initial links given.  My question is; are there other tools which are better than QuickREx?  Or at least one?
i did not know that Regular Expressions were not a "standard."  User_n pointed out that there are ; "Regular expresions are diferent for diferent programing languages."
I googled to learn whether QuickREx could work with Python and it can.
The purpose of this question, is to learn whether I should spend the time to study QuickREx, when in fact there is a better tool than QuickREx.
0
 
chimaAuthor Commented:
thanks for the help.
0
All Courses

From novice to tech pro — start learning today.