dimanche 19 avril 2015

RegEx to replace prefix and postfix

I would like to build a RegEx expression to replace the prefix and postfix of a string. the general string is built from



  1. a known prefix string

  2. some letter a-z or A-Z

  3. some unknown string with letters, hyphens, backslash, slash and numbers.

  4. a hyphen

  5. an integer number

  6. the symbols #.

  7. some string of letters


Examples:



KnownStringr/df-2e\d-3724#.Gkjsu
KnownStringEd\e4v-bn-824#.YKfg
KnownStringa-YK224E\yy-379924#.awws


I would like to replace the prefix and postfix of the NUMBER so that I get:



MyPrefix3724MyPostfix
MyPrefix824MyPostfix
MyPrefix379924MyPostfix

Aucun commentaire:

Enregistrer un commentaire