LoginSignup
1
1

More than 3 years have passed since last update.

正規表現メモ(更新随時)

Last updated at Posted at 2016-11-16

数字+改行を数字+タブに変更する

([0-9]+)\r
↓
$1\t

カンマ区切りの金額の正規表現(増税に伴う修正とかに使えそう)

税込(0|([1-9][0-9]{0,2}(,[0-9]{3})*?)|0|([1-9][0-9]{0,2}(,[0-9]{3})*?))円|(0|([1-9][0-9]{0,2}(,[0-9]{3})*?)|0|([1-9][0-9]{0,2}(,[0-9]{3})*?))円(税込)

CSS/SASS関係

ショートハンド書いたbackground-sizeを通常のものに戻す

置換したいCSS

background: url(/img/bg.png) 50% top /100px 50px no-repeat;

正規表現

検索:(.*)\s\/(\d+px\s\d+px)\s(.*);
置換:$1 $3;\nbackground-size: $2;

置換されたCSS

background: url(/img/bg.png) 50% top no-repeat;
background-size: 100px 50px;

XXpxをSASSで作った関数yyで囲まれたpxなしの数字にしたい(マイナス対応)

検索:\s([\-]?[0-9]+?)(px)
置換 yy($1)
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1