How to write this regular expression for InputFilter

  1. No limit on character encoding value
  2. Length between 1-150
  3. Cannot start as a ‘\n’
  4. A ‘\n’ cannot follow an another ‘\n’
  5. Cannot start with a sequence of blank space with length longer than 20
  6. If not a start, the length of the sequence of blank space shouldn’t be longer than 30

    By the way, this regular expression is used for InputFilter in Android, I need to set a input limitation to EditText.