Our new Appfire Documentation Space is now live!

Take a look here! If you have any questions please email support@appfire.com

How to add regular expression check validator for IP address and host name

Regular expression check validator helps in validating the inputs entered by a user within the custom field, against the regex used in a validator. This article helps to add a regular expression check validator for IP address and hostname for a multi-line text field.

Use cases:

  • Regex to validate the IP Address and hostname entered in the single-line text field on the create issue screen

  • Regex to validate the IP Addresses and hostnames entered in the multi-line text field on the create issue screen

  • Regex to validate either the IP Address or hostname on the create issue screen

Instructions

Please note, the steps below are added on the Create Issue transition. The validator can be added anywhere on the workflow transition according to your requirement.

  1. Edit the workflow that is associated with your project

  2. Select the Create Issue transition

  3. Select the Validators tab and click Add validator

  4. Select Regular Expression Check (JSU) validator and click Add

  5. Select the field to be checked as the custom field Text Field (multi-line), where the user input in the issue is validated by using the regular expression

  6. Enter the following Regular expression in the Regular expression field:

    ^((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|(?:(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$).*$


     The best practice is to test the regular expression before you enter in the validator for the best matching results. The regular expression can be tested here https://www.freeformatter.com/java-regex-tester.html

     

  7. Enter a message in the Error message(optional) text box, which is displayed on the screen, if the validation fails or the field is left empty

     

  8. Click Add and publish the workflow

  9. Create an issue by providing the inputs (IP address and hostname in a multi-line text field) thus it validates!