webMethods

webMethods

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
  • 1.  replacing trailing space using regex

    Posted Sat January 10, 2009 09:08 AM

    Hello,

    I am trying to replace a string with a trailing space with an special character #. I am using pub:String:replace service to do it

    inString : AR (spaces before and after)
    searchString : / (space)
    replaceString : #
    useRegex : True.

    This above things replace all the spaces before and after AR with #. What should be the input of replaceString if I have to just replace the trailing part with #. Expected ouput is AR######

    Thanks in advance.

    Jiten


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


  • 2.  RE: replacing trailing space using regex

    Posted Mon January 12, 2009 04:45 PM

    Try " $" without the quotes.

    The regex supported in IS is described in Apppendix B of the Developer User’s Guide.


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


  • 3.  RE: replacing trailing space using regex

    Posted Tue January 13, 2009 04:20 PM

    That’s nice excercise!

    For input=" AR “, output=” AR#" solution is obvious … but for " AR###" is not so straightforward :slight_smile: (doing it in one pub.string:replace)


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


  • 4.  RE: replacing trailing space using regex

    Posted Tue January 13, 2009 05:42 PM

    Is that a statement or a question?


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


  • 5.  RE: replacing trailing space using regex

    Posted Wed January 14, 2009 01:06 PM

    Another way to replace ending spaces is with look-ahead token " (?= *$)".


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