String manipulation/extraction

  • Hi, im wondering if it's possible to replace certain words in a string... like numbers or email addresses.

    Say we have a string

    SET @string = 'Hi my email is test@email.com but i also have another@email.com and my phone is 997554'

    Is it possible to get following output:

    'Hi my email is confidential but i also have confidential and my phone is confidential'

    Ty for your time

  • You can, using REPLACE or some other kind of syntax, given that you can identify what to replace with 'confidential'.

    You would have to tokenize the input string and identify the tokens that can be interpreted as emails or phone numbers.

    One possible solution is splitting the string on whitespaces using Jeff Moden's splitter[/url] and test the tokens for special characters, such as "@" or numbers.

    Needless to say that this would better belong to the presentation layer.

    -- Gianluca Sartori

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply