Uploaded image for project: 'Automation for Cloud'
  1. Automation for Cloud
  2. AUTO-1085

Including a double quote (") in the regex pattern results in the string being cut short before it's sent to the Match function.

XMLWordPrintable

    • Minor
    • Jira Software, Jira Service Management, Jira Work Management

      Issue Summary

      Including a double quote (") in the regex pattern results in the string being cut short before it's sent to the Match function. and it is not possible to escape the double-quote character.

      Steps to Reproduce

      1. Create an automation rule
      2. Create a variable named text with the following value:
      cl = {AAA a aaa aa AAA=[AAAA  {fieldId='customfield_10154', field='AA aa aa to aaa', fieldType='null', from='12345', fromString='Best possible fit', to='12345', toString='Very good'}  ]} 
      1. Log the following match function:
      {{text.match("fromString=\'([a-zA-Z0-9\"\-\[\]\/\\!£$%^&*()_+={}:@~;'#<>?.| ]*)\'")}}
      1. Notice that the "\ part doesn't work as desired although it works in Java - see the link https://regex101.com/r/hQ91BF/1 
      2. However, if you log the above match function without the "\ part, it works correctly:
      {{text.match("fromString=\'([a-zA-Z0-9\-\[\]\/\\!£$%^&*()_+={}:@~;'#<>?.| ]*)\'")}} 

      Expected Results

      It should be possible to escape the double quote (") within the match function.

      Actual Results

      It is not possible to escape the double quote (") within the match function.

      Workaround

      1) Create a variable, named varRegEx. Note the outer double-quotation marks have been removed.

      fromString=\'([a-zA-Z0-9\"\-\[\]\/\\!£$%^&*()_+={}:@~;'#<>?.| ]*)\'

      2) Perform the match, passing the variable as the search

      {{text.match(varRegEx)}}

              Unassigned Unassigned
              2711b2aa3c24 Barışcan Elkama (Inactive)
              Votes:
              3 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: