地球ウォーカー2

Scala, Python の勉強日記

2009-09-06から1日間の記事一覧

Input要素の<code>value</code>

<input type="text" id="pattern" value="\d" /> <script type="text/javascript"> var p1 = '\d'; var p2 = document.getElementById('pattern').value; console.log('p1 is ' + p1); // → p1 is d console.log('p2 is ' + p2); // → p2 is \d console.log(new RegExp(p1).test(123)); // → false console.log(new RegExp(…