Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381
JavaScriptで正規表現を使って文字列を検索・置換・分割したりする時のメモ | アド企画 制作部

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381
アド企画 制作部
アド企画 制作部
 

JavaScriptで正規表現を使って文字列を検索・置換・分割したりする時のメモ

JavaScriptで正規表現を使って文字列を検索・置換・分割したりする時のメモ

JavaScriptで正規表現って たまにしか使わないので、毎回「アレ? これでいいんだっけ?」ってなる。


JavaScriptで正規表現を使って文字列を検索したり(PHPだとpreg_match)、置き換えしたり(PHPだとpreg_replace)、分割したり(PHPだとpreg_split)する時の記述方法をメモしておく。


RegExpオブジェクトを使うまでもない事が多いので、このメモではRegExpオブジェクトは使わない方向で。

サンプルコード


参考になるサイト

正規表現 - JavaScript | MDN

String.prototype.replace() - JavaScript | MDN




Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381

Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/users/1/ukgadokikaku/web/adokikaku.com/dev.adokikaku.com/wp-includes/formatting.php on line 4381