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.

 View Only
Expand all | Collapse all

Using regular expressions in labels

  • 1.  Using regular expressions in labels

    Posted Wed October 09, 2002 12:33 AM

    I just noticed that there was a few questions on a “competing” discussion group (no, not Advantage) about being able use a single FLOW step to determine if a string if null, empty, has spaces, etc. I thought I’d share some info on using regular expressions as labels.

    The syntax is described in an appendix in the B2B Integrator/IS Developer Guide. For labels, the expression must be surrounded by slashes.

    Here’s a flow example:

    BRANCH on ‘/tailOfAK5’
    /.+/: MAP (tailOfAK5 has one or more chars, maybe spaces)
    $default: SEQUENCE (tailOfAK5 is empty or null)

    Other examples:

    /.+/
    Selected if branch switch has one or more characters, including just spaces. Strings that are $null or are empty will not be selected by this label (e.g. the branch won’t take this path). Strings that have only spaces WILL take this branch.

    /^ISA/
    Selected if branch switch starts with the characters “ISA”.

    /[^ ]/
    Selected if branch switch not null, not empty, and contains at least one non-space character.

    /[^ \t\r\n]/
    Selected if branch switch not null, not empty, and contains at least one non-whitespace character.

    Ain’t it cool? :slight_smile:

    Enjoy!


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


  • 2.  RE: Using regular expressions in labels

    Posted Wed October 09, 2002 02:01 AM

    Way cool! Thanks Rob! I’ve found your regex tips very useful!
    How about an ezine article on regular expressions? :slight_smile:

    Sonam


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


  • 3.  RE: Using regular expressions in labels

    Posted Thu July 12, 2007 10:05 AM

    Does the expression /[^ ]/ work for wM v6.1 ?

    I know it works on v6.5


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


  • 4.  RE: Using regular expressions in labels

    Posted Thu July 12, 2007 03:09 PM

    Yes , it does work for 6.1.


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


  • 5.  RE: Using regular expressions in labels

    Posted Mon July 30, 2007 04:36 AM

    I’ve a scenario where I want to put in a test scenario:

    If document A is empty or null, throw error
    Else if there is data, proceed to next step.

    I’ve tried to do this by setting this branch statement:
    Branch on /documentA
    /[^ ]/ - Process
    $default - Throw error

    This works if documentA is null (no tags at all).
    But if documentA has tags (empty), it’ll go to the /[^ ]/ section.

    Is there any other way i can do this?


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


  • 6.  RE: Using regular expressions in labels

    Posted Sun August 19, 2007 01:19 PM

    Helo Everyone,
    Can u please tell me how to use If condition in an Sequence as well as tell me about LABELS and SWITCH in weMethods 6.0


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


  • 7.  RE: Using regular expressions in labels

    Posted Sun August 19, 2007 11:22 PM

    These two basic uses of the BRANCH statement are covered in the Developer User’s Guide. Please review that and the feel free to ask any specific questions here.

    Mark


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


  • 8.  RE: Using regular expressions in labels

    Posted Mon August 20, 2007 05:25 AM

    Hello Bluewave,

    What do you mean by Tags? Looks like it is not blanks. Check out what is the hex code of these tags. That could help to resolve.

    HTH
    BS


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


  • 9.  RE: Using regular expressions in labels

    Posted Mon August 20, 2007 01:20 PM

    This regular expression works only on strings. If you have a document, it won’t work as you seem to expect. An “empty” document isn’t a common thing to test for (other than comparing with $null)–usually you test for the presence of a field or two within the document.


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