Help us understand the problem. What is going on with this article?

atomで置換を使って連番テキストを作る

More than 1 year has passed since last update.
<input type="text" name="hoge1" id="hoge1">
<input type="text" name="hoge2" id="hoge2">
<input type="text" name="hoge3" id="hoge3">

上のようなHTMLを10個くらい作りたい時、一個作ってコピーして作る方法が真っ先に思いつく。だが、いちいち数字部分にカーソルを合わせて消去して数字タイプしてっていうのも面倒くさい。そこでAtomによる置換を使って連番テキストを楽に作る方法を考えた。

1
2
3
4
5
〜(中略)〜
10

上のような数字だけのテキストを用意しておき、ctrl+fで置換パレットを開く。

置換前

^(\d\d|\d)

置換後

<input type="text" name="hoge$1" id="hoge$1">

のように数字で置換させたい箇所を$1で置き換える。
これで置換を行えば10個のinputタグを生成できる。

追記

Emmetで連番テキストを作るという上位互換の記事が作られたのでリンク
Emmetを利用して連番テキストを作る
http://qiita.com/from_kyushu/items/34e522fa284fa64a5215

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした