Remove duplicate characters using a regular expression

Posted by Alex on Stack Overflow See other posts from Stack Overflow or by Alex
Published on 2010-04-27T21:12:16Z Indexed on 2010/04/27 21:13 UTC
Read the original article Hit count: 277

Filed under:
|
|

I need to Match the second and subsequent occurances of the * character using a regular expression. I'm actually using the Replace method to remove them so here's some examples of before and after:

test*     ->  test* (no change)
*test*    ->  *test
test** *e ->  test* e

Is it possible to do this with a regular expression? Thanks

© Stack Overflow or respective owner

Related posts about regex

Related posts about regular-expressions