IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only
  • 1.  Regular expressions - result

    Posted 10/27/10 03:12 PM

    Hi,

    It’s been awhile but need to ask this question. I have a string that I would to use regex to perform search in that string.

    String input:
    This is a test from 12345.3345.mail@domain.com. Text1 text 2 text3.

    In the input string, I would like to search for ‘@domain.com’ and I want it to provide the entire result as '[EMAIL=“12345.3345.mail@domain.com”]12345.3345.mail@domain.com’[/EMAIL] Is there a function that I can use in my flow?


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 2.  RE: Regular expressions - result

    Posted 10/28/10 01:50 AM

    Hi pthcincy,
    U can get that function by using the flowservice named indexOf under wmpublic.pub.string:subString. For eg. Input text is test123@Mail.com

    subString Inputs
    instring → String input
    beginIndex → point from where in the input string will be the substring will start
    Endindex → end point of the INput string or End point of the Search string ur looking for


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 3.  RE: Regular expressions - result

    Posted 10/28/10 02:12 PM

    V_Rock,

    How does that work when you don’t know the beginIndex and Endindex? What if the input string is

    1234.5678.mail@domain.com test1 test2 test3.

    I want to search “@domain.com” and I want the output to be “1234.5678.mail@domain.com


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 4.  RE: Regular expressions - result

    Posted 10/28/10 09:14 PM

    // pipeline
    IDataCursor pipelineCursor = pipeline.getCursor();
    String inputString = IDataUtil.getString( pipelineCursor, “inputString” );
    String regexString = IDataUtil.getString( pipelineCursor, “regexString” );
    pipelineCursor.destroy();

    ArrayList x=new ArrayList();

    Pattern pat;
    Matcher mat;
    pat=Pattern.compile(regexString);
    mat=pat.matcher(inputString);
    while(mat.find())
    {
    x.add(mat.group());

    }

    // pipeline
    IDataCursor pipelineCursor_1 = pipeline.getCursor();
    IDataUtil.put( pipelineCursor_1, “matchingwods”, x.toArray() );
    pipelineCursor_1.destroy();

    For input string provide String input:

    for regex provide [^" "]+@domain.com

    The problem is output will be list of objects not in string format.


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 5.  RE: Regular expressions - result

    Posted 10/29/10 09:21 AM

    There is also the service PSUtilities.regex:find in PSUtilities with the same inputs.


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 6.  RE: Regular expressions - result

    Posted 10/29/10 11:42 AM

    If it is definitive that there is going to be only one email address present in the input string then this should work :

     
    String domainString = mat.group().toString(); 

    and you can get it as a string.


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods