0
0

More than 3 years have passed since last update.

オブジェクトに何かを代入している処理を探す正規表現

Posted at

訳あって、ツクールMVのプラグインの中から循環参照を探すことになった。
この場合、オブジェクトに代入処理をしているすべての処理を探り、その中から犯人を捜すことになる。
代入処理をすべて検索するには以下の記述を使う。

this\.(.*)( *)=( *)([^true|false|\d| new (.*)].+)

これは最適化もしてないし、否定条件は使いながら書き換えている。
もちろん他の代入パターンも考えられるが、基本的にはこれで問題ないはずである。

テストに使用したデータは以下の通り。

this.aaa =baa
this.bbb = baa
this.ccc=ccc

this.boo()
this.xxx = true
this.yyy = false
this.zzz =19
this.nnn = new hoge()
this.nnn = new hage(xxxx)
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