[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Regular Expressions

Posted on 2013-05-12
8
Medium Priority
?
588 Views
Last Modified: 2013-05-15
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?
0
Comment
Question by:chima
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 9

Assisted Solution

by:user_n
user_n earned 300 total points
ID: 39159779
Regular expresions are diferent for diferent programing languages
0
 

Author Comment

by:chima
ID: 39159861
user_n, really! now that's a pain.  Okay, for Python then.
0
 
LVL 29

Expert Comment

by:pepr
ID: 39159917
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 84

Assisted Solution

by:ozo
ozo earned 200 total points
ID: 39160615
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
 
LVL 29

Expert Comment

by:pepr
ID: 39160653
@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
 

Author Comment

by:chima
ID: 39166614
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
 
LVL 29

Accepted Solution

by:
pepr earned 1500 total points
ID: 39167223
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
 

Author Closing Comment

by:chima
ID: 39169043
thanks for the help.
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question