ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Regualr Expression search in ESQL

Post new topic  Reply to topic
 Regualr Expression search in ESQL « View previous topic :: View next topic » 
Author Message
kevinmark99
PostPosted: Mon May 06, 2013 1:09 pm    Post subject: Regualr Expression search in ESQL Reply with quote

Newbie

Joined: 29 Mar 2013
Posts: 8

ESQL NEWBIE QUESTION:

I have a email ID

datacenter009@gmail.com

ESQL needs to identify this email ID with pattern

datacenter[number][number][number]@gmail.com & transform to

datacenter[number][number][number]dev@gmail.com

How can this be achieved in ESQL? Does ESQL support regular expression?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon May 06, 2013 4:29 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

does it really need to be that specific?

Or can it merely substring BEFORE '@' ?
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Mon May 06, 2013 11:39 pm    Post subject: Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

ESQL is designed for speed and simplicity.

And fit for a particular purpose: msg processing & transformation.

It somewhat spares (by intention) big librarys (provided by FUNCTIONs/PROCEDUREs), while other languages, like C++(STL), JAVA(JCL), PERL(CPAN) or Python(Python Standard Library) are extremely proud of theirs.
But you can use other nodes or WRAPPER-Functions (to call e.g. into Java).
In ESQL it is "based on a few primitive Functions, write your own (waste or save the performance yourself )".

Though I would consider mqjeffs suggestion or if you "require" a reg exp, consider to do it the Broker-way: With a message set.

Or (as mqjeff says) the other broker way: Not with reg exps (Validating/EVALuating can(likely) hurt(s) performance).

Though it depends on the reg exps that you come up with (use simple ones) and the engine you use (probably Broker's parsers, e.g. MRM, are the fastest solution).
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
adubya
PostPosted: Tue May 07, 2013 5:09 am    Post subject: Reply with quote

Partisan

Joined: 25 Aug 2011
Posts: 377
Location: GU12, UK

ESQL does not have sophisticated regex capability. You could implement regex checking in a Java class and call that from ESQL.
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Tue May 07, 2013 5:09 am    Post subject: Re: Regualr Expression search in ESQL Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

kevinmark99 wrote:
How can this be achieved in ESQL? Does ESQL support regular expresson?


ESQL does not support regular expressions.

If the data is part of an input message then consider having a message set do the validation.

If that's not possible for any reason your best recourse is to produce a small Java function that takes a string & reg ex expression as parameters & returns a result. Be sure it's small, tight, efficient and doesn't leak memory. You can call this directly from your ESQL.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kash3338
PostPosted: Wed May 08, 2013 4:52 am    Post subject: Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

If the pattern you have specified is very specific, then you can better do this with a simple Java function and invoke from your ESQL code. If it's just going to be a check on EMail address (@) you can do that using simple ESQL functions.

ESQL does not support RegEx pattern, but to some extent can be acheived through manual code checks. Depending on the complexity you can chose between ESQL and Java.
Back to top
View user's profile Send private message Send e-mail
anurag.munjal
PostPosted: Wed May 08, 2013 9:15 am    Post subject: ESQL Reply with quote

Voyager

Joined: 08 Apr 2012
Posts: 97

Try this out!
Code:

SET A = SUBSTRING('datacenter009@gmail.com' BEFORE '@');
--Sets A = 'datacenter009';

SET B = SUBSTRING('datacenter009@gmail.com' AFTER '@');
--Sets B = 'gmail.com';

SET Final_Email_ID = A ||'dev@' || B
--Sets Final_Email_ID  = 'datacenter009dev@gmail.com';


Back to top
View user's profile Send private message
Vitor
PostPosted: Wed May 08, 2013 10:03 am    Post subject: Re: ESQL Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

anurag.munjal wrote:
Try this out!
Code:

SET A = SUBSTRING('datacenter009@gmail.com' BEFORE '@');
--Sets A = 'datacenter009';

SET B = SUBSTRING('datacenter009@gmail.com' AFTER '@');
--Sets B = 'gmail.com';

SET Final_Email_ID = A ||'dev@' || B
--Sets Final_Email_ID  = 'datacenter009dev@gmail.com';




That doesn't validate an email address in the way

Code:
\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b


does.

Nor does it directly answer the OP's stated intent to extract part of the non-domain portion.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu May 09, 2013 9:20 am    Post subject: Re: ESQL Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Vitor wrote:
anurag.munjal wrote:
Try this out!
Code:

SET A = SUBSTRING('datacenter009@gmail.com' BEFORE '@');
--Sets A = 'datacenter009';

SET B = SUBSTRING('datacenter009@gmail.com' AFTER '@');
--Sets B = 'gmail.com';

SET Final_Email_ID = A ||'dev@' || B
--Sets Final_Email_ID  = 'datacenter009dev@gmail.com';




That doesn't validate an email address in the way

for most values of validate, that's a correct statement.

Vitor wrote:
Code:
\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b


does.

for at least some values of 'validate' that is not a correct statement.

Vitor wrote:
Nor does it directly answer the OP's stated intent to extract part of the non-domain portion.


In fact, it directly does the transformation that the OP wanted to achieve, which is to insert the word "dev" before the @ sign in an email address.

The OP didn't state a specific need to actually confirm that the part before the @ sign was of the pattern 'datacenterNNN'.

That's why I asked if it was strictly necessary to do so.

If it's not strictly necessary to do so, then the solution presented by anurag.munjal is strictly correct for the OP's stated needs.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Regualr Expression search in ESQL
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.