General Discussions

Discuss any topics that are not product-specific here.
SOLVED

Putting a space in the middle of a string

lbolin
8 - Asteroid

is there a simple way to put a space in between the PM and a number. I am new to Regex so i don't really know where to start. Is there a way to do it with out regex. 

 

11:00 AM - 2:00 PM5:00 PM - 9:00 PM

11:00 AM - 2:00 PM4:00 PM - 9:00 PM

11:00 AM - 2:00 PM6:00 PM - 9:00 PM

8 REPLIES 8
PanPP
Alteryx Alumni (Retired)

Hi @lbolin 

 

One way to accomplish this is shown in the attached workflow.

 

Hope this helps, if it does please like this post.

 

 

lbolin
8 - Asteroid

This worked but i didn't think to include that the other data looks like this:

11:00 AM - 9:00 PM

11:00 AM - 12:00 AM (Next day)

is there a way to do it with out touching the others?

 

PanPP
Alteryx Alumni (Retired)

Can you provide the full data set? Regex might be the best option here.

ShankerV
17 - Castor

Hi @lbolin 

 

Can you please share the huge dataset how you data is like.

Also let us know how output should look like, so we can proceed for the solution easily.

 

Many thanks

Shanker V

lbolin
8 - Asteroid

I can not provide the entire data set but here is a sample of the records needing to be parsed. 

 

11:00 AM - 9:00 PM
11:00 AM - 1:00 AM
11:00 AM - 10:00 PM
9:00 AM - 8:30 PM
11:00 AM - 2:00 PM5:00 PM - 10:00 PM
8:00 AM - 11:00 PM
9:30 AM - 8:00 PM
11:00 AM - 10:00 PM
7:30 AM - 8:00 PM
11:30 AM - 2:00 PM5:00 PM - 9:30 PM

 

Result:

11:00 AM - 9:00 PM
11:00 AM - 1:00 AM
11:00 AM - 10:00 PM
9:00 AM - 8:30 PM
11:00 AM - 2:00 PM 5:00 PM - 10:00 PM
8:00 AM - 11:00 PM
9:30 AM - 8:00 PM
11:00 AM - 10:00 PM
7:30 AM - 8:00 PM
11:30 AM - 2:00 PM 5:00 PM - 9:30 PM

 

ShankerV
17 - Castor

Hi @lbolin 

 

Please find the below output.

 

ShankerV_0-1670863018687.png

 

 

Note: The workflow used to achieve the solution is attached which can be downloaded to see how the solution works.

 

If you believe your problem has been resolved. Please mark helpful answers as a solution so that future users with the same problem can find them more easily!!!!

 

Many thanks

Shanker V

 

 

ShankerV
17 - Castor

Hi @lbolin 

 

Tried with many permutation and combination, The workflow gives the desired output.

 

Input:

ShankerV_1-1670863938819.png

 

Output:

ShankerV_0-1670863903063.png

 

Hope it resolves your issue, even if the dataset is huge.

 

PanPP
Alteryx Alumni (Retired)

Hi @lbolin 

 

I have uploaded a sample WF that accomplishes this without regex.

 

Hope this helps, if it does please like this post/mark it as a solution.

 

Labels