2015-05-24 48 views
-1

我是垃圾在正則表達式 - 總是讓自己感到困惑。我一直在問到檢查以下,爲0的字母和1一些基本的正則表達式

1] Must start with a 1 - client has put 1+0|1 
2] Any number of 0s followed by any number of 1s - client has put 0*0|1 
3] Any combination of 0s and 1s - client has put 0*1* 

他們不右看看我...

回答

0

的標準語法是:

  1. 1[01]*
  2. 0*1*
  3. [01]*
+0

我知道這是了!謝謝:)一旦時間到了就會標記爲正確! –

1

您可以使用以下方法:

1: ^1[01]* or ^1[01] if its just starting with 1 and followed by 0 or 1 
2: 0*1* 
3: [01]*