Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created June 15, 2013 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shigemk2/5786700 to your computer and use it in GitHub Desktop.
Save shigemk2/5786700 to your computer and use it in GitHub Desktop.
正規表現でデクリメントしてみた
# -*- coding: utf-8 -*-
hoge = '99999999-1000'
/(-\d*)/ =~ hoge
tekitou = $&.to_i - 1
hoge.gsub!($&, tekitou.to_s)
print(hoge) # 99999999-1001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment