"ABC" かつ "XYZ" を含む文字列にマッチさせる場合において、一つの正規表現で実現する方法を考えます。 なお、"ABC" と "XYZ" のどちらが先に出現するかは決まっていません。
肯定先読みでAND条件の一つ目の条件(ABC)を先読みする事で、2つ目の条件(XYZ)を検索する事が出来ます。
/** | |
* deep-freeze-from-object-1.0.0.js | |
* Freeze the deep objects in the object. | |
* | |
* @version 1.0.0 | |
* @author think49 | |
* @url https://gist.github.com/think49/2aa2f7a19ddc3f2030dd288839c29f2b | |
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License) | |
*/ |
/** | |
* delete-duplicate-line-0.2.1.js | |
* Delete duplicate line. | |
* | |
* @version 0.2.1 | |
* @author think49 | |
* @url https://gist.github.com/think49/9ccf52aa1f2d01e4417b6f0fb2d37ce9 | |
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License) | |
*/ |
/** | |
* nodelist-prototype-foreach.js | |
* The forEach() method of the NodeList interface calls the callback given in parameter once for each value pair in the list, in insertion order. | |
* | |
* @version 1.0.0 | |
* @author think49 | |
* @url https://gist.github.com/think49/df8c54a9aa421db3b650a3c1cab9b4a9 | |
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License) | |
* @see <a href="https://heycam.github.io/webidl/#es-forEach">3.6.9.2. forEach - Web IDL</a> | |
*/ |
/** | |
* create-square-aa-1.0.1.js | |
* create ASCII art square. | |
* | |
* @version 1.0.1 | |
* @author think49 | |
* @url https://gist.github.com/think49/2a30b4e865f3dca4043440fb9b99a448 | |
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License) | |
*/ |
ウインドウのスクロール量を取得するクラスブラウザなコードを考えます。
/** | |
* json-for-date-1.0.2.js | |
* JSON which can serialize Date object | |
* | |
* @version 1.0.2 | |
* @author think49 | |
* @url https://gist.github.com/think49/26fcddaaa63cd0d6b27de8ef9c514c41 | |
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License) | |
*/ |