What is a regular expression that accepts everything in {0,1} but does not have substring 110 or 101?
Accept:
Reject
Edit: In the comments on the answers below, this question requires formal regular expression.
Limited to the formal designation of regular expressions:
((1|0*|0*1)(000*))*0*(10*|1*)
This solution (even without viewing):
/^0*(11*$|10$|100+)*$/
, /101|110/
/101|110/
, , , , regex lookahead.
/^(1(?!01|10)|0)*$/
:
/^([01])\1*$/
DFA .
, "" ( "", "xor", "not", )
,
(0 | 100 | (1 | 10 | 11 *) $) *
This can be solved with a possessive comparison. (111 + $) is 111 ++
Source: https://habr.com/ru/post/1722259/More articles:RuntimeError: declare either attr_protected or attr_accessible for the user, but not both - ruby-on-railsΠΡΠΈΠ±ΠΊΠ° ΠΌΠΈΠ³ΡΠ°ΡΠΈΠΈ Rails MySQL: "ΠΡΠΈΠ±ΠΊΠ° ΠΏΡΠΈ ΠΏΠ΅ΡΠ΅ΠΈΠΌΠ΅Π½ΠΎΠ²Π°Π½ΠΈΠΈ schema_migration (errno: -1)" - rubymysql monitoring for changes - javaShould I use ImageMagick or GD2 with ImageAPI in Drupal? - phpDoes calculating the sum for decimal values ββvia Core Data not working properly? - iphoneFrom arrayList to long [] - javaIPHONE: saving and extracting a dictionary of dictionaries from plist - iphoneIs portable size? - cRuby includes false and nil - ruby ββ| fooobar.comCan we resize size_t in C? - cAll Articles