Skip to content

Instantly share code, notes, and snippets.

@tom--
Created November 12, 2012 22:22
Show Gist options
  • Select an option

  • Save tom--/4062390 to your computer and use it in GitHub Desktop.

Select an option

Save tom--/4062390 to your computer and use it in GitHub Desktop.
string replacement

How to implement this substring replacement rule?

  • %% is replaced with % and %x is replaced with #

which would do, for example,

abc %x def      => abc # def
abc %%x def     => abc %x def
abc %%%x def    => abc %# def
abc %%%%x def   => abc %%x def
abc %%%%%x def  => abc %%# def
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment