Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Trying to extract date from description via regex

Robert Wen_ReleaseTEAM_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Sep 27, 2023

I have a similar problem to this question: https://community.atlassian.com/t5/Jira-questions/Pulling-date-in-string-with-REGEX-from-Description-trying-to/qaq-p/2415519

My date field is in the middle of the Description.  It will be prepended with "Expected start date/effective date".  This is what it looks like:

Employee ID Number: N/A (Employee is a new-hire/rehire)

Expected start date/effective date: 2023-10-02

Is this a: N/A


This is my regular expression:

(?<=Expected start date\/effective date:\W*)(\d+[-]\d+[-]\d+)

here's where I want to put it:

 {{issue.description.match(“(?<=Expected start date\/effective date:\W*)(\d+[-]\d+[-]\d+)")}}

Putting it in an automation doesn't catch it.  Regex testers tell me the regular expression is good.  What am I missing? 

1 answer

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Sep 27, 2023 • edited

Hi @Robert Wen_ReleaseTEAM_ 

Please recall the match() function documentation about regular expressions says the "underlying implementation is based on Java's Pattern class", but it does not say what it actually does (and does not) support: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#match--

My recommendations are:

  • First use a split() command prior to the match, either on newlines or on some pattern text near what you want.  That will reduce the scope the match needs to hit, and help you see when there are multiple matches (because it will return a list).
  • Use the simplest regular expression you can make that will do the job
  • When in doubt, build up the expression slowly, writing intermediate results to the audit log until it works as desired

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events