cancel
Showing results for 
Search instead for 
Did you mean: 

Compare two datespans - possible via Regex?

TerjeGabrielsen
Level 3
Hi all.

I need to be able to check if two datespans share one or more days, like the scenario:
Date 1 span: 05/05/2019 to 05/10/2019 (MM/DD/YYYY)
Date 2 span: 05/03/2019 to 05/08/2019 (MM/DD/YYYY)

If think i need to use Regex to be able to compare this, but i can´t say that my regex skills are sufficient yet to be able to set something like this up at the moment, so if any kind souls out there have som good suggestions i would greatly appreciate it 🙂

------------------------------
Terje Gabrielsen
RPA Developer
Tromso kommune
Europe/Oslo
------------------------------
7 REPLIES 7

david.l.morris
Level 15
(Apologies if you receive this as an email because I don't think the code snippets are handled when sending out emails)

Edit: adjusted the Main page code snippet

I'm terrible with regex. However, you could do this with a few stages in Blue Prism. I would love to just upload a process, but I think that's disabled for me. So, as painful as this might be, I'm going to paste the code into code snippets here. It's three pages: Main Page, Get Span, Get Shared Dates. The Get Span page is used reused for both Spans. I put your initial values into the data inputs. Once you paste it, you'll probably need to open the Page Reference stages and choose the right pages as this likely won't paste over with the reference working. That means you'll also need to put the inputs back in but I think I named them intuitively.

This first code snippet is the code that goes on the main page. This will not create a main page. Just copy and paste into the main page.

<process name="__selection__test file management">
    <stage stageid="0b31b068-41b8-490f-9f49-daeb00952d68" name="Span1Date1" type="Data">
        <narrative></narrative>
        <displayx>-285</displayx>
        <displayy>15</displayy>
        <displaywidth>120</displaywidth>
        <displayheight>30</displayheight>
        <font family="Segoe UI" size="10" style="Regular" color="000000" />
        <datatype>date</datatype>
        <initialvalue>2019/05/05</initialvalue>
        <private />
        <alwaysinit />
    </stage>
    <stage stageid="5bd91ce2-543f-42f6-9ce9-12e475ff74b8" name="Span1Date2" type="Data">
        <narrative></narrative>
        <displayx>-285</displayx>
        <displayy>45</displayy>
        <displaywidth>120</displaywidth>
        <displayheight>30</displayheight>
        <font family="Segoe UI" size="10" style="Regular" color="000000" />
        <datatype>date</datatype>
        <initialvalue>2019/05/10</initialvalue>
        <private />
        <alwaysinit />
    </stage>
    <stage stageid="cd271cef-168a-44e4-bcb6-dbd1326a01bb" name="Span2Date1" type="Data">
        <narrative></narrative>
        <displayx>-150</displayx>
        <displayy>15</displayy>
        <displaywidth>120</displaywidth>
        <displayheight>30</displayheight>
        <font family="Segoe UI" size="10" style="Regular" color="000000" />
        <datatype>date</datatype>
        <initialvalue>2019/05/03</initialvalue>
        <private />
        <alwaysinit />
    </stage>
    <stage stageid="75768a55-8ee0-4deb-99a2-8efcf52cb769" name="Span2Date2" type="Data">
        <narrative></narrative>
        <displayx>-150</displayx>
        <displayy>45</displayy>
        <displaywidth>120</displaywidth>
        <displayheight>30</displayheight>
        <font family="Segoe UI" size="10" style="Regular" color="000000" />
        <datatype>date</datatype>
        <initialvalue>2019/05/08</initialvalue>
        <private />
        <alwaysinit />
    </stage>
    <stage stageid="c8dfa3fd-a925-4c5e-ad19-58a7e42e87d1" name="Span1" type="Collection">
        <narrative></narrative>
        <displayx>-285</displayx>
        <displayy>105</displayy>
        <displaywidth>120</displaywidth>
        <displayheight>30</displayheight>
        <font family="Segoe UI" size="10" style="Regular" color="000000" />
        <datatype>collection</datatype>
        <private />
        <alwaysinit />
        <collectioninfo>
            <field name="Date" type="date" />
        </collectioninfo>
    </stage>
    <stage stageid="91b98c7d-63a9-41f5-a582-d61de61cef6c" name="Span2" type="Collection">
        <narrative></narrative>
        <displayx>-150</displayx>
        <displayy>105</displayy>
        <displaywidth>120</displaywidth>
        <displayheight>30</displayheight>
        <font family="Segoe UI" size="10" style="Regular" color="000000" />
        <datatype>collection</datatype>
        <private />
        <alwaysinit />
        <collectioninfo>
            <field name="Date" type="date" />
        </collectioninfo>
    </stage>
    <stage stageid="8c4f3b34-ee0c-44bb-a718-39462c0fa7c8" name="Get Span1" type="SubSheet">
        <narrative>Input for Date1: [Span1Date1]
Input for Date2: [Span1Date2]
Output for Span: Span1</narrative>
        <displayx>15</displayx>
        <displayy>-60</displayy>
        <displaywidth>60</displaywidth>
        <displayheight>30</displayheight>
        <font family="Segoe UI" size="10" style="Regular" color="000000" />
        <inputs>
            <input type="date" name="Date1" friendlyname="Date1" expr="[Span1Date1]" />
            <input type="date" name="Date2" friendlyname="Date2" expr="[Span1Date2]" />
        </inputs>
        <outputs>
            <output type="collection" name="Span" friendlyname="Span" stage="Span1" />
        </outputs>
        <onsuccess>2b94c847-3453-4261-810e-87a78380607f</onsuccess>
        <processid>8207ef10-7b47-41ac-bf84-cf90d9b990ff</processid>
    </stage>
    <stage stageid="2b94c847-3453-4261-810e-87a78380607f" name="Get Span2" type="SubSheet">
        <narrative>Input for Date1: [Span2Date1]
Input for Date2: [Span2Date2]
Output for Span: Span2</narrative>
        <displayx>15</displayx>
        <displayy>-15</displayy>
        <displaywidth>60</displaywidth>
        <displayheight>30</displayheight>
        <font family="Segoe UI" size="10" style="Regular" color="000000" />
        <inputs>
            <input type="date" name="Date1" friendlyname="Date1" expr="[Span2Date1]" />
            <input type="date" name="Date2" friendlyname="Date2" expr="[Span2Date2]" />
        </inputs>
        <outputs>
            <output type="collection" name="Span" friendlyname="Span" stage="Span2" />
        </outputs>
        <onsuccess>bc440d80-1edb-4649-80a6-c501f2b8c35b</onsuccess>
        <processid>8207ef10-7b47-41ac-bf84-cf90d9b990ff</processid>
    </stage>
    <stage stageid="bc440d80-1edb-4649-80a6-c501f2b8c35b" name="Get Shared Dates" type="SubSheet">
        <narrative>Input for Span1: [Span1]
Input for Span2: [Span2]
Output for Shared Dates: Shared Dates</narrative>
        <displayx>15</displayx>
        <displayy>30</displayy>
        <displaywidth>60</displaywidth>
        <displayheight>30</displayheight>
        <font family="Segoe UI" size="10" style="Regular" color="000000" />
        <inputs>
            <input type="collection" name="Span1" friendlyname="Span1" expr="[Span1]" />
            <input type="collection" name="Span2" friendlyname="Span2" expr="[Span2]" />
        </inputs>
        <outputs>
            <output type="collection" name="Shared Dates" friendlyname="Shared Dates" stage="Shared Dates" />
        </outputs>
        <processid>654f8851-3ee1-4dc2-8cb4-6cbfb2a686f9</processid>
    </stage>
    <stage stageid="2baf37f3-bb17-4adc-a5a4-47530d18b175" name="Shared Dates" type="Collection">
        <narrative></narrative>
        <displayx>-225</displayx>
        <displayy>150</displayy>
        <displaywidth>120</displaywidth>
        <displayheight>30</displayheight>
        <font family="Segoe UI" size="10" style="Regular" color="000000" />
        <datatype>collection</datatype>
        <private />
        <alwaysinit />
        <collectioninfo>
            <field name="Date" type="date" />
        </collectioninfo>
    </stage>
    <stage stageid="94614f1e-652d-41e9-9285-a8a3774025dc" name="Inputs" type="Block">
        <narrative></narrative>
        <displayx>-345</displayx>
        <displayy>-15</displayy>
        <displaywidth>255</displaywidth>
        <displayheight>75</displayheight>
        <font family="Segoe UI" size="10" style="Regular" color="00FFFF" />
    </stage>
    <stage stageid="51d178bc-4e8d-4386-baf3-9d6f523b0bdd" name="Outputs" type="Block">
        <narrative></narrative>
        <displayx>-345</displayx>
        <displayy>75</displayy>
        <displaywidth>255</displaywidth>
        <displayheight>90</displayheight>
        <font family="Segoe UI" size="10" style="Regular" color="FFFF99" />
    </stage>
</process>



This second code snippet is the Get Span page (this is the entire page since I assume it won't exist already). You should be able to right click on the Page Tabs in Process Studio and paste to create the page.
<process name="__selection__Test Get Shared Dates">
  <subsheet subsheetid="5bf80649-ef45-4203-960a-82803cf77d56" type="Normal" published="False">
    <name>Get Span</name>
    <view>
      <camerax>0</camerax>
      <cameray>0</cameray>
      <zoom version="2">1.25</zoom>
    </view>
  </subsheet>
  <stage stageid="89b310b0-7744-4d9b-ae25-c2f4aeec6a2c" name="Get Span" type="SubSheetInfo">
    <subsheetid>5bf80649-ef45-4203-960a-82803cf77d56</subsheetid>
    <narrative></narrative>
    <displayx>-195</displayx>
    <displayy>-105</displayy>
    <displaywidth>150</displaywidth>
    <displayheight>90</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
  </stage>
  <stage stageid="24d701ef-04c9-4b59-aca1-9cbe75860d0e" name="Start" type="Start">
    <subsheetid>5bf80649-ef45-4203-960a-82803cf77d56</subsheetid>
    <narrative></narrative>
    <displayx>-60</displayx>
    <displayy>-135</displayy>
    <displaywidth>60</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <inputs>
      <input type="date" name="Date1" stage="Date1" />
      <input type="date" name="Date2" stage="Date2" />
    </inputs>
    <onsuccess>357eeed5-d8be-42ec-9450-bb5b4e1f3d3a</onsuccess>
  </stage>
  <stage stageid="81d42d2e-e0d8-4818-9003-5afcd38956d5" name="End" type="End">
    <subsheetid>5bf80649-ef45-4203-960a-82803cf77d56</subsheetid>
    <narrative></narrative>
    <displayx>-60</displayx>
    <displayy>90</displayy>
    <displaywidth>60</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <outputs>
      <output type="collection" name="Span" stage="Span" />
    </outputs>
  </stage>
  <stage stageid="593053ba-ce71-4f0f-9d0d-603e7b34c20a" name="Date1" type="Data">
    <subsheetid>5bf80649-ef45-4203-960a-82803cf77d56</subsheetid>
    <narrative></narrative>
    <displayx>-195</displayx>
    <displayy>-15</displayy>
    <displaywidth>150</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <datatype>date</datatype>
    <initialvalue />
    <private />
    <alwaysinit />
  </stage>
  <stage stageid="a3476b3f-f5cd-42a4-940b-cf0e93ae8951" name="Date2" type="Data">
    <subsheetid>5bf80649-ef45-4203-960a-82803cf77d56</subsheetid>
    <narrative></narrative>
    <displayx>-195</displayx>
    <displayy>45</displayy>
    <displaywidth>150</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <datatype>date</datatype>
    <initialvalue />
    <private />
    <alwaysinit />
  </stage>
  <stage stageid="45bf7be7-2695-434f-bb57-2233f9d022c6" name="Span" type="Collection">
    <subsheetid>5bf80649-ef45-4203-960a-82803cf77d56</subsheetid>
    <narrative></narrative>
    <displayx>-195</displayx>
    <displayy>90</displayy>
    <displaywidth>150</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <datatype>collection</datatype>
    <private />
    <alwaysinit />
    <collectioninfo>
      <field name="Date" type="date" />
    </collectioninfo>
  </stage>
  <stage stageid="b0c6e071-a9b6-4f74-8ad5-09a512ba8f3d" name="Add Row" type="Action">
    <subsheetid>5bf80649-ef45-4203-960a-82803cf77d56</subsheetid>
    <loginhibit onsuccess="true" />
    <narrative></narrative>
    <displayx>-60</displayx>
    <displayy>-45</displayy>
    <displaywidth>60</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <inputs>
      <input type="text" name="Collection Name" friendlyname="Collection Name" narrative="The name of the collection to act upon" expr="&quot;Span&quot;" />
    </inputs>
    <onsuccess>9a6cbc36-3acf-42f1-9117-8a3dd6d36e72</onsuccess>
    <resource object="Blueprism.AutomateProcessCore.clsCollectionActions" action="Add Row" />
  </stage>
  <stage stageid="357eeed5-d8be-42ec-9450-bb5b4e1f3d3a" name="Set Date1 to Date" type="Calculation">
    <subsheetid>5bf80649-ef45-4203-960a-82803cf77d56</subsheetid>
    <narrative></narrative>
    <displayx>-60</displayx>
    <displayy>-90</displayy>
    <displaywidth>60</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <onsuccess>b0c6e071-a9b6-4f74-8ad5-09a512ba8f3d</onsuccess>
    <calculation expression="[Date1]" stage="Date" />
  </stage>
  <stage stageid="aa135d16-16c0-4abf-8d67-547732950926" name="Date" type="Data">
    <subsheetid>5bf80649-ef45-4203-960a-82803cf77d56</subsheetid>
    <narrative></narrative>
    <displayx>-195</displayx>
    <displayy>15</displayy>
    <displaywidth>150</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <datatype>date</datatype>
    <initialvalue />
    <private />
    <alwaysinit />
  </stage>
  <stage stageid="9a6cbc36-3acf-42f1-9117-8a3dd6d36e72" name="Set Date To Span.Date" type="Calculation">
    <subsheetid>5bf80649-ef45-4203-960a-82803cf77d56</subsheetid>
    <narrative></narrative>
    <displayx>-60</displayx>
    <displayy>0</displayy>
    <displaywidth>60</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <onsuccess>c3356977-d0c3-483d-8815-3d6111ed5daa</onsuccess>
    <calculation expression="[Date]" stage="Span.Date" />
  </stage>
  <stage stageid="e2dcaabd-bc94-4446-8034-00068fcbe910" name="Add 1 Day to Date" type="Calculation">
    <subsheetid>5bf80649-ef45-4203-960a-82803cf77d56</subsheetid>
    <narrative></narrative>
    <displayx>15</displayx>
    <displayy>45</displayy>
    <displaywidth>60</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <onsuccess>c626a6c3-b99e-4bf9-8bf5-2ce4793f37a4</onsuccess>
    <calculation expression="[Date]+MakeTimeSpan(1,0,0,0)" stage="Date" />
  </stage>
  <stage stageid="c3356977-d0c3-483d-8815-3d6111ed5daa" name="Date2 Reached?" type="Decision">
    <subsheetid>5bf80649-ef45-4203-960a-82803cf77d56</subsheetid>
    <narrative></narrative>
    <displayx>-60</displayx>
    <displayy>45</displayy>
    <displaywidth>60</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <decision expression="[Date]=[Date2]" />
    <ontrue>81d42d2e-e0d8-4818-9003-5afcd38956d5</ontrue>
    <onfalse>e2dcaabd-bc94-4446-8034-00068fcbe910</onfalse>
  </stage>
  <stage stageid="c626a6c3-b99e-4bf9-8bf5-2ce4793f37a4" name="Anchor1" type="Anchor">
    <subsheetid>5bf80649-ef45-4203-960a-82803cf77d56</subsheetid>
    <narrative></narrative>
    <displayx>15</displayx>
    <displayy>-45</displayy>
    <displaywidth>10</displaywidth>
    <displayheight>10</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <onsuccess>b0c6e071-a9b6-4f74-8ad5-09a512ba8f3d</onsuccess>
  </stage>
</process>


This third code snippet is the third page. Same thing here where this is assuming there is not already a page called Get Shared Dates.
<process name="__selection__Test Get Shared Dates">
  <subsheet subsheetid="a6e15cbf-3168-4529-99de-03148f15997a" type="Normal" published="False">
    <name>Get Shared Dates</name>
    <view>
      <camerax>0</camerax>
      <cameray>0</cameray>
      <zoom version="2">1.25</zoom>
    </view>
  </subsheet>
  <stage stageid="a1b63a4d-9a9f-47be-985b-5e23624f8cd2" name="Get Shared Dates" type="SubSheetInfo">
    <subsheetid>a6e15cbf-3168-4529-99de-03148f15997a</subsheetid>
    <narrative></narrative>
    <displayx>-195</displayx>
    <displayy>-105</displayy>
    <displaywidth>150</displaywidth>
    <displayheight>90</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
  </stage>
  <stage stageid="bf9c426c-021f-4621-a32f-1d30c7057aca" name="Start" type="Start">
    <subsheetid>a6e15cbf-3168-4529-99de-03148f15997a</subsheetid>
    <narrative></narrative>
    <displayx>-60</displayx>
    <displayy>-135</displayy>
    <displaywidth>60</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <inputs>
      <input type="collection" name="Span1" stage="Span1" />
      <input type="collection" name="Span2" stage="Span2" />
    </inputs>
    <onsuccess>a7ab2ede-c60e-4d83-b580-1fbdeed64075</onsuccess>
  </stage>
  <stage stageid="ba50f33e-4670-4b91-a413-809357fdb4e1" name="End" type="End">
    <subsheetid>a6e15cbf-3168-4529-99de-03148f15997a</subsheetid>
    <narrative></narrative>
    <displayx>-60</displayx>
    <displayy>90</displayy>
    <displaywidth>60</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <outputs>
      <output type="collection" name="Shared Dates" stage="Shared Dates" />
    </outputs>
  </stage>
  <stage stageid="a7ab2ede-c60e-4d83-b580-1fbdeed64075" name="Loop Span1" type="LoopStart">
    <subsheetid>a6e15cbf-3168-4529-99de-03148f15997a</subsheetid>
    <narrative></narrative>
    <displayx>-60</displayx>
    <displayy>-90</displayy>
    <displaywidth>60</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <onsuccess>b634c1ef-4d53-4c8e-bf2e-8ba708970982</onsuccess>
    <groupid>70397537-7812-47f7-be7d-8a240bcf5140</groupid>
    <looptype>ForEach</looptype>
    <loopdata>Span1</loopdata>
  </stage>
  <stage stageid="a3861efd-7d85-4d80-8d6b-006316b36466" name="Loop Span1" type="LoopEnd">
    <subsheetid>a6e15cbf-3168-4529-99de-03148f15997a</subsheetid>
    <narrative></narrative>
    <displayx>-60</displayx>
    <displayy>45</displayy>
    <displaywidth>60</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <onsuccess>ba50f33e-4670-4b91-a413-809357fdb4e1</onsuccess>
    <groupid>70397537-7812-47f7-be7d-8a240bcf5140</groupid>
  </stage>
  <stage stageid="b634c1ef-4d53-4c8e-bf2e-8ba708970982" name="Determine if Shared Date" type="Action">
    <subsheetid>a6e15cbf-3168-4529-99de-03148f15997a</subsheetid>
    <loginhibit onsuccess="true" />
    <narrative></narrative>
    <displayx>-60</displayx>
    <displayy>-45</displayy>
    <displaywidth>60</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <inputs>
      <input type="collection" name="Collection" friendlyname="Collection" narrative="Required : The collection to search" expr="[Span2]" />
      <input type="text" name="Column Name" friendlyname="Column Name" narrative="Required : The name of the column to search" expr="&quot;Date&quot;" />
      <input type="text" name="Exact Value" friendlyname="Exact Value" narrative="Optional : The exact value to search for - this is case insensitive" expr="[Span1.Date]" />
      <input type="text" name="Regex" friendlyname="Regex" narrative="Optional : The regular expression to search for - this is case sensitive unless specified otherwise in the regular expression using &quot;(?i)&quot;" expr="" />
    </inputs>
    <outputs>
      <output type="flag" name="Contains Search Term" friendlyname="Contains Search Term" narrative="Flag indicating if the collection found the given search term or not" stage="Date Shared" />
      <output type="collection" name="Groups" friendlyname="Groups" narrative="The groups defined in the regular expression when it is applied to the found term" stage="" />
    </outputs>
    <onsuccess>c4893346-f4dc-4f73-8858-c6baff9d25a0</onsuccess>
    <resource object="DLLib - Wrapper - Utility - Collection Manipulation" action="Collection Contains Value" />
  </stage>
  <stage stageid="3d86b630-5b57-4cb4-bc15-6012cb6697b2" name="Date Shared" type="Data">
    <subsheetid>a6e15cbf-3168-4529-99de-03148f15997a</subsheetid>
    <narrative></narrative>
    <displayx>-195</displayx>
    <displayy>30</displayy>
    <displaywidth>150</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <datatype>flag</datatype>
    <initialvalue />
    <private />
    <alwaysinit />
  </stage>
  <stage stageid="316c25aa-9102-40c3-b5de-2510e062fecb" name="Span1" type="Collection">
    <subsheetid>a6e15cbf-3168-4529-99de-03148f15997a</subsheetid>
    <narrative></narrative>
    <displayx>-195</displayx>
    <displayy>-30</displayy>
    <displaywidth>150</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <datatype>collection</datatype>
    <private />
    <alwaysinit />
    <collectioninfo>
      <field name="Date" type="date" />
    </collectioninfo>
  </stage>
  <stage stageid="84675bbe-107f-4229-b698-3492de97b9be" name="Span2" type="Collection">
    <subsheetid>a6e15cbf-3168-4529-99de-03148f15997a</subsheetid>
    <narrative></narrative>
    <displayx>-195</displayx>
    <displayy>0</displayy>
    <displaywidth>150</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <datatype>collection</datatype>
    <private />
    <alwaysinit />
    <collectioninfo>
      <field name="Date" type="date" />
    </collectioninfo>
  </stage>
  <stage stageid="9533f04d-30c6-4ab2-b325-980146f57755" name="Shared Dates" type="Collection">
    <subsheetid>a6e15cbf-3168-4529-99de-03148f15997a</subsheetid>
    <narrative></narrative>
    <displayx>-195</displayx>
    <displayy>60</displayy>
    <displaywidth>150</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <datatype>collection</datatype>
    <private />
    <alwaysinit />
    <collectioninfo>
      <field name="Date" type="date" />
    </collectioninfo>
  </stage>
  <stage stageid="c4893346-f4dc-4f73-8858-c6baff9d25a0" name="Date Shared?" type="Decision">
    <subsheetid>a6e15cbf-3168-4529-99de-03148f15997a</subsheetid>
    <narrative></narrative>
    <displayx>-60</displayx>
    <displayy>0</displayy>
    <displaywidth>60</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <decision expression="[Date Shared]" />
    <ontrue>de51d3d5-5537-4069-8efc-9ede1b88e663</ontrue>
    <onfalse>a3861efd-7d85-4d80-8d6b-006316b36466</onfalse>
  </stage>
  <stage stageid="de51d3d5-5537-4069-8efc-9ede1b88e663" name="Add Row" type="Action">
    <subsheetid>a6e15cbf-3168-4529-99de-03148f15997a</subsheetid>
    <loginhibit onsuccess="true" />
    <narrative></narrative>
    <displayx>15</displayx>
    <displayy>0</displayy>
    <displaywidth>60</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <inputs>
      <input type="text" name="Collection Name" friendlyname="Collection Name" narrative="The name of the collection to act upon" expr="&quot;Shared Dates&quot;" />
    </inputs>
    <onsuccess>95405ac3-dac1-40ad-98f6-e368ad6c62e5</onsuccess>
    <resource object="Blueprism.AutomateProcessCore.clsCollectionActions" action="Add Row" />
  </stage>
  <stage stageid="95405ac3-dac1-40ad-98f6-e368ad6c62e5" name="Set Date To Shared Dates" type="Calculation">
    <subsheetid>a6e15cbf-3168-4529-99de-03148f15997a</subsheetid>
    <narrative></narrative>
    <displayx>15</displayx>
    <displayy>45</displayy>
    <displaywidth>60</displaywidth>
    <displayheight>30</displayheight>
    <font family="Segoe UI" size="10" style="Regular" color="000000" />
    <onsuccess>a3861efd-7d85-4d80-8d6b-006316b36466</onsuccess>
    <calculation expression="[Span1.Date]" stage="Shared Dates.Date" />
  </stage>
</process>


------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------

Dave Morris, 3Ci at Southern Company

GopalBhaire
Level 10

This can be easily done without using Regex.Find the furthest date between starting datespan - in this case 05/05/2019 [Date1] is further between 05/05/201905/03/2019, then find  the earliest date between ending datespan in this case 05/08/2019 [Date2] occurs earlier between 05/10/201905/08/2019.  Then just take get the diff between the two dates DateDiff(9,[Date1],[Date2])  if positive then that's your no. of shared days.


Edit if you want to validate & extract date using Extract Regex Values action of Utility - String the your pattern is
(?<D1>(0|1)[0-9]\/[0-3][0-9]\/(2)[0-9]{3})\s*(to)\s*(?<D2>(0|1)[0-9]\/[0-3][0-9]\/(2)[0-9]{3})​
Make a collecting with fields Name(text) and Value(DateTime) and add two rows to the collection and set 'Name' column of row 1 to D1 and row 2 to D2, store the output in same collection.

@Dave Morris wondering why uploading is disabled for you?

------------------------------
Gopal Bhaire
Analyst
Accenture
------------------------------

Thank you both Dave, and Gopal. I really appreciate that you took the time to reply to my post.

Dave, we have tried to import the code snippets in BP. The first one was imported without problem, the other was complaining about some formatting issues. But we are currently working on trying to get this to work 🙂

Gopal, can you shed some more information about just excactly you would set this up in BP if you wouldn´t mind?

We tried the datediff option before posting this, but just failed to see just how this seamlessly could be setup... Probably just thinking way to overcomplicated, so a push or three in the right direction would be greatly appreciated 🙂

If we could make this work without even using regex, that would be just freaking awesome.



------------------------------
Terje Gabrielsen
RPA Developer
Tromso kommune
Europe/Oslo
------------------------------

Update Dave, we got it imported correct now. Was just some small adjustment needed.

We´ll check out the code snippets, thank you so much again for the effort to try to help us with this 🙂



------------------------------
Terje Gabrielsen
RPA Developer
Tromso kommune
Europe/Oslo
------------------------------

What adjustment was needed? I really wish I could just upload attachments, but it may be disabled for me to do so. I probably just need to submit for this site to be an exception to a rule or something.

I guess I could have exported the entire object and pasted that XML into a code snippet but I figured that would be even more lines of XML.

------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------

Dave Morris, 3Ci at Southern Company

PFA a process to calculate shared days between two time spans, I didn't use Regex.

------------------------------
Gopal Bhaire
Analyst
Accenture
------------------------------

Thank you so much for this, Gopal! That just worked like a charm, and was just what i wanted.... 🙂

I really appreciate the reply to this post, from both you guys.

------------------------------
Terje Gabrielsen
RPA Developer
Tromso kommune
Europe/Oslo
------------------------------