Thursday, April 3, 2008

substitute() macro

It's not documented anywhere so here you go:

^ matches the beginning of the string
$ matches the end of the string

Multiple substitute() calls can be nested into one another.

e.g. to put a string into square brackets you could write

substitute('^', '[', substitute('$', ']', '_string_goes_here'))

2 comments:

  1. Proved very useful in my current task at hand. Shame cognos doesn't provide details in their help doc. But luckily we have got generous people like you
    Thanks and keep it up :)

    ReplyDelete
  2. Hi
    Please help me out here:
    This is my filter expression:
    [intID] in (#substitute ('[regular expression]','',csv( split(',', prompt('p_Client', 'token') ) ))#).

    I'm trying to replace all occurrences of single quotes in the CSV list. What will be the reg ex to substitute ALL the single quotes?

    Thanks
    Wasim

    ReplyDelete