Defect #29195

Regular expression for Long text formatted custom fields does not work multiline

Added by Juan Garcia about 4 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:


Category:Custom fields
Target version:-
Resolution: Affected version:3.4.6


When using custom fields with format Long text, the Regular expression does not fully validate the field, as it seems to not be working multiline and global.

Using our case as example for this issue:

We want to validate a field named Steps to reproduce. We use the following regex:

(([1-9]+[0-9]*\. [A-Z]+.*?(\n|$))+)

And the following field Default value as a template:

1. Start the application
. Observe the issue

The template by itself without modification by the issue reporter should not validate. A valid example of a correct field would be:

1. Start the application
2. Go to "Help" 
3. Click "About" 
4. Observe the issue

However, Redmine only validates the first line of the field. If the first line line does not pass the regex test, Redmine correctly complains "Steps To Reproduce is invalid". But it does ignores everything in the following lines.

There is no workaround that could work by rewriting the regular expression.

Possible solutions:

1. Make all Long text custom fields regex global and multiline by default
2. Add additional checkboxes in custom field edit page with Multiline and Global to complement the Regular expression field


We can confirm this issue in both our current production environment as well as our test environment (the version of which will be migrating our production environment soon).

Production Environment:
  Redmine version                3.2.1.stable
  Ruby version                   2.3.4-p301 (2017-03-30) [x86_64-linux-gnu]
  Rails version                  4.2.6
  Environment                    production
  Database adapter               Mysql2
Test Enviroment:
  Redmine version                3.4.2.stable
  Ruby version                   2.3.4-p301 (2017-03-30) [x86_64-linux-gnu]
  Rails version                  4.2.8
  Environment                    production
  Database adapter               Mysql2

Also available in: Atom PDF