Am trying to extract required words through pattern mapping.
Below is the sample data in the object table
+-----------+-------------------------------------------------------------------------------------------------+ | Unique_Id | Text | +-----------+-------------------------------------------------------------------------------------------------+ | Ax23z12 | Tool generated code 2015-8134 upon further validation, the tool confirmed the code as 2015-8134 | +-----------+-------------------------------------------------------------------------------------------------+
using below code
regmatches(table[1,2],gregexpr("2000-\\d{4}",table[1,2]))
am able to extract output as
[[1]]
[1] "2000-0511" "2000-0511"
However the Output am looking for is like below
+-----------+---------------------------------------------------------------------------+-----------+-----------+ | Unique_Id | Text | Column1 | Column2 | +-----------+---------------------------------------------------------------------------+-----------+-----------+ | Ax23z12 | Tool generated code 2015-8134 upon further validation, the tool confirmed | 2015-8134 | 2015-8134 | | | the code as 2015-8134 | | | +-----------+---------------------------------------------------------------------------+-----------+-----------+
Data under text column consists this number multiple times (maximum 7 times) hence looking for dynamic solution
Thank you so much