LoginSignup
0
0

More than 5 years have passed since last update.

【SublimeText2】 置換するときエスケープしなきゃいけない文字

Posted at

こちらの記事を参考に、一括置換しようとしたが、上手くいかない、、
http://qiita.com/miupink/items/9fda800b4bb5ef0bc731

原因は検索対象がjQueryの記述で
$や(などエスケープしなきゃいけない文字があったからだ。。

hoge.js
// こいつを検索したい
$(function(){
    var boderHeight = $("#linkArea").height();
});

そこでエスケープしなきゃいけない文字一覧をメモ


エスケープが必要な文字(必要ない場合や処理系もあり)
\\
\.
\*
\^
\$
\+
\|
\?
\(
\)
\[
\]
\{
\}

こんな感じで検索かけたら上手くいった。

hoge.js
// こいつを検索したい
\$\(function\(\)\{
    var boderHeight = \$\("#linkArea"\).height\(\);
\}\);

参考
http://yoshikawaweb.com/regex-cheat-sheet-for-text-editor.html

おわり。

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