&lt;div&gt;</p>

<pre><code>var re = new RegExp('j.*t')
</code></pre>

<p>undefined
var re = new RegExp(&quot;j.<em>t&quot;);
undefined
re
/j.</em>t/
var re = /j.<em>t/
undefined
re
/j.</em>t/
re.global
false
re.ignoreCase
false
re.multiline
false
var re = new RegExp(&quot;j.<em>t&quot;)
undefined
re
/j.</em>t/
var re = /j.<em>t/ig;
undefined
re
/j.</em>t/gi
re.ignoreCase
true
re.global
true
re.ignoreCase
true
re.mulreligne
undefined
re.multeline
undefined
re.mulitiline
undefined
re.multiline
false
re.multiline
false
/j.<em>t/.test(&quot;javascript&quot;);
true
re.test(&quot;javascript&quot;)
true
/j.</em>t/i.test('javascript');
true
/j.<em>t/.exec(&quot;javascript&quot;)[0]
&quot;javascript&quot;
/j.</em>t/.exec(&quot;javascript&quot;,&quot;eee&quot;)[1]
undefined
var s = new String('HellowJavascriptWorld');
undefined
s
String {0: &quot;H&quot;, 1: &quot;e&quot;, 2: &quot;l&quot;, 3: &quot;l&quot;, 4: &quot;o&quot;, 5: &quot;w&quot;, 6: &quot;J&quot;, 7: &quot;a&quot;, 8: &quot;v&quot;, 9: &quot;a&quot;, 10: &quot;s&quot;, 11: &quot;c&quot;, 12: &quot;r&quot;, 13: &quot;i&quot;, 14: &quot;p&quot;, 15: &quot;t&quot;, 16: &quot;W&quot;, 17: &quot;o&quot;, 18: &quot;r&quot;, 19: &quot;l&quot;, 20: &quot;d&quot;, length: 21, [[PrimitiveValue]]: &quot;HellowJavascriptWorld&quot;}
s.match(/a/);
[&quot;a&quot;]
s.match(/a/g);
[&quot;a&quot;, &quot;a&quot;]
s.match(/a/ig);
[&quot;a&quot;, &quot;a&quot;]
s.match(/j.<em>/ig);
[&quot;JavascriptWorld&quot;]
s.match(/j.</em>a/i);
[&quot;Java&quot;]
s.match(/j.<em>s/i);
[&quot;Javas&quot;]
s.match(/j.</em>c/i);
[&quot;Javasc&quot;]
s.match(/a.<em>c/i);
[&quot;avasc&quot;]
s.match(/a.</em>c/i);
[&quot;avasc&quot;]
s.search(/a.<em>c/i);
7
s.search(/j.</em>c/i);
6
s.search(/j.<em>c/i);
6
s.search(/j.</em>a/i);
6
s.search(/j.<em>a/i);
6
s.replace(/[A-Z]/g,'');
&quot;ellowavascriptorld&quot;
s.replace(/[a-z]/g,'');
&quot;HJW&quot;
s.replace(/[A-Z]/,'');
&quot;ellowJavascriptWorld&quot;
s.replace(/[A-Z]/,'<em>$&amp;');
&quot;_HellowJavascriptWorld&quot;
s.replace(/[A-Z]/g,'</em>$&amp;');
&quot;<em>Hellow_Javascript_World&quot;
s.replace(/([A-Z])/g,'</em>$1');
&quot;<em>Hellow_Javascript_World&quot;
s.replace(/([A-Z])/g,'</em>$1');
&quot;_Hellow_Javascript_World&quot;
var email = morita@yahoo.co.jp
Uncaught SyntaxError: Unexpected token ILLEGAL VM1156:732
email
Uncaught ReferenceError: email is not defined VM2116:2
var email = 'morita@yahoo.co.jp'
undefined
email
&quot;morita@yahoo.co.jp&quot;
var username = /.</em>@/i;
undefined
var username = email.replace(/.<em>@/i);
undefined
var username = email.replace(/.</em>@/i);
undefined
username
&quot;undefinedyahoo.co.jp&quot;
var username = email.replace(/(.<em>)@.</em>/,&quot;$1&quot;);
undefined
username
&quot;morita&quot;
function replaceCallback(match){return &quot;<em>&quot;+ match.toLowerCase();}
undefined
function replaceCallback(match){return &quot;</em>&quot;+ match.toLowerCase();}
s.replace(/[A-Z]/g,replaceCallback);
&quot;_hellow_javascript_world&quot;
var glob;
undefined
var re = /(.*)@(.*)&#46;(.*)/;
undefined
re
/(.*)@(.*)&#46;(.*)/
var callback = function(){
glob = arguments;
return arguments[1] + 'at' + arguments[2] + 'dot' + arguments[3];
}
undefined
&quot;moritakenji@yahoo.co.jp&quot;.replace(re,callback);
&quot;moritakenjiatyahoo.codotjp&quot;
var callback = function(){
glob = arguments;
return arguments[1] + ' at ' + arguments[2] + ' dot ' + arguments[3];
}
undefined
&quot;moritakenji@yahoo.co.jp&quot;.replace(re,callback);
&quot;moritakenji at yahoo.co dot jp&quot;
glob
[&quot;moritakenji@yahoo.co.jp&quot;, &quot;moritakenji&quot;, &quot;yahoo.co&quot;, &quot;jp&quot;, 0, &quot;moritakenji@yahoo.co.jp&quot;]ß
&lt;/div&gt;
var reg = new RegExp('^[0-9]');
reg.test('foo');
false
reg.test('123');
true
var reg = /'^[0-9]'/;
undefined
var reg = /'^[0-9]'/;
function RegExp(){</p>

<p>}
undefined
var reg = /'^[0-9]'/;
reg.constructor;</p>

<p>function RegExp() { [native code] }
var reg = /'^[0-9]'/g;
var reg = /^\s+/;
undefined
reg
/^\s+/
var reg = new RegExp('^\s+');
undefined
var reg = new RegExp('^&#92;s+');
undefined
reg
RegExp {}
var text = 'abc def ghi jkl';
var reg = /(\w+)\s(\w+)/;
reg.exec(text);
[&quot;abc def&quot;, &quot;abc&quot;, &quot;def&quot;]
var reg = /(\w+)\s(\w+)/g;
undefined
reg
/(\w+)\s(\w+)/g
var text = 'abc def ghi jkl';
undefined
reg.exec(text);
[&quot;abc def&quot;, &quot;abc&quot;, &quot;def&quot;]
reg.exec(text);
[&quot;ghi jkl&quot;, &quot;ghi&quot;, &quot;jkl&quot;]
reg.exec(text);
null
var text = 'moritakenji';
var result = text.search(/^kan/g);
result;
-1
var text = 'moritakenji';
var result = text.search(/^moirta/g);
result;
-1
var text = 'moritakenji';
var result = text.search(/^(moirta)/g);
result;
-1
var text = 'abc def ghi jkl';
text.replace(/\s/,',');
&quot;abc,def ghi jkl&quot;
var text = 'abc def ghi jkl';
text.replace(/\s/g,',');
&quot;abc,def,ghi,jkl&quot;
text.replace(/(.)\s/g,',$1');
&quot;ab,cde,fgh,ijkl&quot;
text.replace(/(.)\s/g,function(01m,02m){return ','+ 02m});
Uncaught SyntaxError: Unexpected token ILLEGAL VM50:732
text.replace(/(.)\s/g,function(m0,m1){return ','+ m1});
&quot;ab,cde,fgh,ijkl&quot;
var text = 'abc def ghi jkl';
undefined
text
&quot;abc def ghi jkl&quot;
text.match(/\w/g);
[&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;, &quot;e&quot;, &quot;f&quot;, &quot;g&quot;, &quot;h&quot;, &quot;i&quot;, &quot;j&quot;, &quot;k&quot;, &quot;l&quot;]
text.match(/(w+)\s/g);
null
text.match(/(w)\s/g);
null
text.match(/(.)\s/g);
[&quot;c &quot;, &quot;f &quot;, &quot;i &quot;]
text.match(/(.)\s/g);
[&quot;c &quot;, &quot;f &quot;, &quot;i &quot;]
text.match(/([a-z]{,3})\s/g);
null
text.match(/([a-z]{3})\s/g);
[&quot;abc &quot;, &quot;def &quot;, &quot;ghi &quot;]
text.match(/([a-z]{1,2})\s/g);
[&quot;bc &quot;, &quot;ef &quot;, &quot;hi &quot;]
text.match(/([a-z]{0,1})\s/g);
[&quot;c &quot;, &quot;f &quot;, &quot;i &quot;]
text.match(/([a-z]{3})\s/g);
[&quot;abc &quot;, &quot;def &quot;, &quot;ghi &quot;]
text.match(/(\w+)\s(\w+)/g);
[&quot;abc def&quot;, &quot;ghi jkl&quot;]

(Visited 1 times, 1 visits today)

コメントを残す

メールアドレスが公開されることはありません。