LoginSignup
2
1

More than 5 years have passed since last update.

[android] Android Studioで正規表現に変数を使って置換する方法

Last updated at Posted at 2017-07-11

○AndroidStudioで置換するとき、正規表現に変数を使う

正規表現する前の文字列.
"hoge"
"100"
"トマト"

↓ 置換操作 (*ctrl [macはcommand] + r)(*正規表現regexを ☑️ )
スクリーンショット 2017-07-11 17.24.32.png
文字列: 上→"(.*)"  下→$1

正規表現した後の文字列.
hoge
100
トマト

[解説]
・()で囲んだ部分が変数$1に入る

2
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
2
1