cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PaulD1
Super User
Super User

Find the start of a pattern (regular expression) within a string

Hi

 

I'm fairly new to Flow so I'll give you my full scenario as well as the specific issue just in case I am missing an easier method to achieve my goal.

 

Scenario: I'm pulling an array from a SharePoint list then using a Select to return just the columns of interest. I am then passing these results to Create HTML table. All good so far! However, one column is a date/time column returning results as '2017-10-27T08:00:00' whereas I want to see all the dates in the format '2017-10-27'.

 

I'm thinking to check for the location of text within the HTML that matches the pattern -\d\dT\d\d: (i.e. hyphen, number, number, T, number, number, colon) and then using substring to get rid of the time portion of the date/time.

 

I'll need to loop, replacing one instance at a time, until all instances are removed but I'm OK with that. The issue I have is that Indexof does not appear to work with regular expressions. I see that contains supports regular expressions but only returns True/False, not the location within the text.

 

So, am I on the right path converting to html first and then 'reformatting' instances of dates in the text string (I don't see a way to convert the date format within the Select operation), and if so, how do I go about getting the location of text matching a regular expression?

 

Thanks!

P

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-yuazh-msft
Community Support
Community Support

Hi @PaulD1,

 

Do you have a date time column in the sharepoint list and want to get the date in the column with format "yyyy-MM-dd".

 

If you have a date time column in the sharepoint list and want to get the date in the column with format "yyyy-MM-dd",please format the date time to "yyyy-MM-dd" in the Select action, you could please refer to screenshot below to create the flow:

Capture.PNG

 

The expression of the EndDate as below:

formatDateTime(item()?['EndDate'],'yyyy-MM-dd')

The flow would run successfully as below:

Capture.PNG

 

 

Best regards,

Alice

 

View solution in original post

2 REPLIES 2
v-yuazh-msft
Community Support
Community Support

Hi @PaulD1,

 

Do you have a date time column in the sharepoint list and want to get the date in the column with format "yyyy-MM-dd".

 

If you have a date time column in the sharepoint list and want to get the date in the column with format "yyyy-MM-dd",please format the date time to "yyyy-MM-dd" in the Select action, you could please refer to screenshot below to create the flow:

Capture.PNG

 

The expression of the EndDate as below:

formatDateTime(item()?['EndDate'],'yyyy-MM-dd')

The flow would run successfully as below:

Capture.PNG

 

 

Best regards,

Alice

 

View solution in original post

Thanks Alice (@v-yuazh-msft)

 

That is exactly what I needed! Perfect.

 

Because the date fields I wanted to format disappear from the Dynamic Content list when I add an Expression (within the mapping in the Select step), I assumed that I couldn't take that approach. As a relative newbie, I'm finding that one the greatest hurdles - the 'intellisense' seems to fail to provide all the valid options.

 

Thanks again. 

Paul

Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (58,460)