1 Reply Latest reply: Nov 20, 2007 6:48 PM by 807603 RSS

    Search and replace, with pattern matching using a table

    807603
      I need to inspect a data stream and standardise a set of codes. I need to

      1. Match any patterns with a dash character and remove the dash and any following characters, eg BN-S -> BN, BN-SH -> BN, ARG-22 -> ARG, etc.

      2. Make a few specific word for word replacements, eg, PAEDSH -> PAED

      This is easy to hard code but can it be done using a table of regex substitutions? Can anyone give a pointer or link to some example code? The couple of regex replacement examples I've found use regex to locate but hard code substitutions.

      Thanks