0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ワイルドカードってなんだっけ

0
Posted at

ワイルドカードってなんだっけ?

この場所には何が来てもいい
を表す特殊記号

基本のイメージ

例:abc* という検索条件があったとする。

abc*

これは、

  • abc
  • abc1
  • abc999
  • abc_xyz
  • abcAABBCC

abc で始まるすべて」 にマッチする。

記号 意味 イメージ図
* 0文字以上のあらゆる文字列 abc* → abc, abc1, abcXYZ, ...
? 1文字だけの任意の文字 a?c → abc, acc, a1c, ...
[...] 指定した文字のどれか1文字 a[xyz]c → axc, ayc, azc
{a,b,c} a / b / c のいずれか {dog,cat,bird} → dog または cat または bird

よくある使い方

ファイル検索

*.jpg → jpg画像すべて
report_*.pdf → report_ で始まるPDF

SQL の LIKE

WHERE name LIKE '田中%'

→ 田中太郎、田中一郎、田中Aなど「田中で始まる全て」

WHERE email LIKE '%@gmail.com'

→ gmail.com のメールアドレス全部

CLIでのワイルドカード

rm *.log

→ すべての .log ファイルを削除

cp images/*.png backup/

→ 画像フォルダの pngを全てコピー

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?