Skip to main content

Multiline regex validation in HTML viewer displayform

Comments

9 comments

  • Zack Robison
    ...looks like I need to test some forms...
    0
  • Zack Robison
    Here's what I'm using with success: ^.{0,100}$
    0
  • Berend Veldkamp
    Zack,

     

    That does not work if the textarea contains newlines.

     

    User-added image
    0
  • Hi Berend

    I have used this for a textarea formelement, that max could recive max. 1000 chraracters.

    (\s\|.){0,999}$

    0
  • Berend Veldkamp
    Sebastian,

     

    Are you sure that's the exact regex you're using? I copied it, and just replaced 999 with 10, but when I try it, any input is accepted, both in de Workflow Designer and in the HTML viewer.

     

    Or are you using the new workflow 5? I'm still at 4.8
    0
  • Zack Robison
    How about ^(.|\s){0,1000}$
    0
  • Berend Veldkamp
    Thanks, that works perfectly!
    0
  • Zack Robison
    It had better!  You just saved me from a future bug hunt.
    0
  • Keith Burdette

    I've been trying to build a similar check in a text area form - no more than 750 characters and allow newlines.

    I had been using

    ^.{0,750}$

    until a user pointed out that newlines break this.  I've tried

    ^(.|\s){0,750}$

    But when I hit submit, my page returns unresponsive warnings and can take two minutes or more to tell me that my input is invalid.

    I'm running this form in workflow 4 in Essentials 4.14.4 and tested it in both Edge and Chrome and both get the slow response times.

    0

Please sign in to leave a comment.