Forum Discussion

AngelRodriguez's avatar
AngelRodriguez
Qrew Assistant Captain
5 years ago

Pipelines and Regex

I'm currently working on a Pipeline to automate our in-house IT Help Desk, but I'm running into issues with the "matches regex" option in the Outlook Channel "Search Emails" step. 

What I'm trying to do is find a sequence like "Ticket #20200618-1507-RM-74". I created a regular expression that I would normally add to a function in JavaScript like so: 
/Ticket #\d{8}-\d{4}-\w{2}-\d{2}/g


I'm trying to catch a pattern in the subject line "Ticket" & # & 8 digits & - & 4 digits & - & 2 letters & - & 2 digits" with the global flag appended to the end. It works in JavaScript, but it seems as if Pipelines doesn't recognize this pattern.

Is there a a specific way of writing regex with Pipelines or am I completely off track with the "matches regex" option in Pipelines for the Outlook "Search Emails" option?

​I'm also attaching an image of the "Search Emails" step I'm referencing with the "matches regex" conditional step. I don't see any documentation referencing how to use regex with Pipelines either.

When I run the Pipeline I get a "Found no Emails" response in the "Running Pipeline" window. The email is in the inbox with that exact pattern, but Pipelines does not recognize my regex pattern.

Thanks!



------------------------------
AR
------------------------------
  • AngelRodriguez's avatar
    AngelRodriguez
    Qrew Assistant Captain
    I figured this piece out in case anyone comes across this when trying to create a Pipeline. The Regex Pipeline step offers a link to test the Regex you've written. I found that the usual Regex forward slashes are not necessary when writing a regular expression in Pipelines. So my Subject -> matches regex = /Ticket #\d{8}-\d{4}-\w{2}-\d{2,4}/g can be written without the forward slashes and by removing the global flag. So I wrote Ticket #\d{8}-\d{4}-\w{2}-\d{2,4}

    I was able to pick up the pattern that I was trying to identify within this step in the Pipeline:

    Your Ticket #20200615-1658-AR-57 has been created with a Priority of "04-Low".





    ------------------------------
    Angel Rodriguez
    Application Developer
    ------------------------------