| [reply] [d/l] |
Thanks pbeckingham, this was exactly the answer I needed. The key here was being able to test *on the fly*, which this accomplishes well.
| [reply] |
Scott,
I haven't used it yet, but the jEdit editor has plugin called "Regular Expression Tester". I like jEdit, this might do what you need.
jEdit also has a "PerlBrowse" plugin that might also be handy in your situation.
| [reply] |
What I sometimes do when working with a regex is to isolate it out into a test script that will just test the working of the regex so I will know quite quickly if it is doing what I expect. | [reply] |
Let's re-phrase the question to: Is there a way that I can test prior to running a progrgam whether or not a regular expression will compile.
The answer is Yes, use the -c flag when invoking perl. You can use: Perl -c myprogram, or you might make the program read in the regex from an external file ... possibly specifying which file on the command line. Then you only have to test the regex file: Perl -c regexfile.
--
TTTATCGGTCGTTATATAGATGTTTGCA
| [reply] |
That doesn't work if the regex is passed in as a parameter, say if you are doing something screwy like loading it from a database. The way to do that is probably to check at startup, or otherwise write another program, to run eval-block type tests on each of the many regexes that can be imported.
| [reply] |
I'm just asking for two cents here, since I don't really know the full circumstances of this situation. But I'm writing because someone mentioned accepting regexs through a database.
In a worst case scenario, isn't this kind of asking for trouble? What if someone wanted to insert malicious code into this running script? Granted, I really don't know the full implications of using an Eval block to run unknown code, but wouldn't using Reval be a bit more desirable with something like this? I'm just thinking in terms of reducing the amount of risk present to a computer.
If I'm way off base here, I'd appreciate some clarification on this. Whenever I thought I had an excuse to use an Eval, I always found a much better way through refactoring. :)
----
Thanks for your patience.
Prove your knowledge @ HLPD
| [reply] |
| [reply] |