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.
ユーザーは次のように入力できます。 I $1 $5 $10 $20 $50 $100
注文は重要ではなく、金種が複数回入力されても心配ありません (つまり、I $1 $5 $5)。入力の先頭は大文字の「I」で始まり、その後にスペースが続きます。
私がこれまでに持っているのはこれですが、正規表現にあまり慣れていないため、目的のパターンに一致させることはできません:
^I\s(\$1|\$[5]|\$10|\$20|\$50|\$[100])$
入力が有効であることを検証したい。