Author |
Message
|
mqpaul |
Posted: Fri Feb 01, 2008 4:46 am Post subject: An alternative |
|
|
 Acolyte
Joined: 14 Jan 2008 Posts: 66 Location: Hursley, UK
|
This doesn't answer the question, but one way to achieve that sort of processing could be to use a JavaCompute node and the java.util.regex package. Its regex language is documented in the Java JDK 1.5 javadoc for java.util.regex.Pattern. _________________ Paul |
|
Back to top |
|
 |
Vitor |
Posted: Fri Feb 01, 2008 4:57 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
This is actually a response to:
http://www.mqseries.net/phpBB2/viewtopic.php?t=41654
Which I split from the circa-2002 post it was put on,but clearly not quickly enough (or too quickly!) _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
DaveCanto |
Posted: Fri Feb 01, 2008 5:57 am Post subject: |
|
|
 Novice
Joined: 01 Feb 2008 Posts: 11 Location: Belgium - EU
|
This is my original question:
DaveCanto wrote: |
I'm asking myself: "Is it possible to use regular expressions in the ESQL-code of a Compute-node?"
This would be a very powerful feature of the broker. Today you can use regular expressions only when defining a message set to extract different data fields in an intelligent way. Instead of using always the same build-in string functions (like SUBSTRING / REPLACE / LEFT / RIGHT ... ) I would like to use regex for this.
Maybe this can be a feature request for the next version of the broker?! |
Mqpaul, the JavaCompute node you mention here, is this the standard Compute-node included in the Message Brokers Toolkit v5.1.0? Or is it a custom-made node you developped yourself? Where do I find more info about extending the toolkit with extra Java-packages? _________________ Do not underestimate the power of ... unit testing and continuous integration. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Feb 01, 2008 6:07 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Java added RegEx support in JDK 1.4.
So it's built into both JDK 1.4 and 1.5 - both of which are supported by WMB v6 - and 1.5 is supported by WMB v6.1.
One could then write a static Java procedure and wrap that in an ESQL procedure call.
That said... it's better to do as much parsing using pre-supplied parsers as possible - so that you keep the physical represenation of the data separate from the logical transformation. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
chrisc |
Posted: Sun Feb 03, 2008 4:42 pm Post subject: |
|
|
Voyager
Joined: 19 Mar 2006 Posts: 77
|
I always liked the quote (I don't know the source, sorry) -
"Someone who looks at a problem and thinks 'I could use regular expressions to solve that!' now has two problems."
 |
|
Back to top |
|
 |
jefflowrey |
Posted: Sun Feb 03, 2008 6:17 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
chrisc wrote: |
I always liked the quote (I don't know the source, sorry) -
"Someone who looks at a problem and thinks 'I could use regular expressions to solve that!' now has two problems."
 |
The only problems that can't be solved by regular expressions are those that a) can't be solved at all, or b) have to be solved using a context free grammar instead, or c) have to be solved using a Turing machine...
 _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
DaveCanto |
Posted: Mon Feb 04, 2008 7:52 am Post subject: |
|
|
 Novice
Joined: 01 Feb 2008 Posts: 11 Location: Belgium - EU
|
Why do regular expressions have to be difficult per definition? There are many useful tools around on the net.
I started to use "The Regulator" from Roy Osherove for building .NET-related regular expressions and so far it does the trick for me. Check it out @ tools.osherove.com and go to "Cool Tools - The Regulator".  _________________ Do not underestimate the power of ... unit testing and continuous integration. |
|
Back to top |
|
 |
|