regexMatch - ADF Data flows

Vivek Komarla Bhaskar 911 Reputation points
2022-09-18T19:10:49.643+00:00

I want to identify if there is a date in a string. Below are few examples -

Vivek 18 09 22
Vivek180922
Vivek 18/09/22
Vivek 18-09-22
Vivek18-09-2022242296-screenshot-2022-09-18-at-201003.png

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,553 questions
{count} votes

1 answer

Sort by: Most helpful
  1. AnnuKumari-MSFT 32,741 Reputation points Microsoft Employee
    2022-09-19T04:33:40.26+00:00

    Hi @Vivek Komarla Bhaskar ,

    Thankyou for using Microsoft Q&A platform and thanks for posting your question here.

    As per my understanding , it looks you are trying to check if the string contains valid date or not using regular expressions in dataflow. Please let me know if my understanding is incorrect.

    • (19|20)\d\d represents year between 1900-01-01 till 2099-12-31
    • The month is matched by 0[1-9]|1[012]
    • (0[1-9]|[12][0-9]|3[01]) matches the dates between 1st Jan to 31st Dec
    • [- /.] is for the delimiter , matches for either - or /

    You can use : regexMatch(regexReplace(Title,'[@!\sa-zA-Z]',''),^(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d$) expression to achieve your requirement.

    Here we are first trying to remove A-Z characters/any special characters from the Column so as to get only the date part to perform the matching of the pattern.
    Then checking for the pattern : dd/mm/yyyy or dd-mm-yyyy . If this matches, it should return true.

    242373-image.png

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button and kindly take the satisfaction survey whenever the information provided helps you.
      Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.