Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
入力フィールドがあり、価格入力フィールドの値のドットの存在を確認したい。値は次のようになります12.00。これが私のコードです
12.00
<g:textField class="span3" id="price" name="price" required="" pattern="\d+(\.\d{2})?"/>
このように書いたのです\d+(\.\d{2})?が、エラーが発生しました。助言がありますか ?
\d+(\.\d{2})?
これを試して
[0-9]+(\\.[0-9][0-9]?)?
<form> <input type='number' pattern='[0-9]+(\\.[0-9][0-9]?)?' /> <button type='submit'>Check</button> </form>
正解は [0-9]+(\.[0-9][0-9]?)? です。