I am attempting to isolate a particular section of a line, and delete everything else after it.
Below are some example strings on what the general formatting of the file looks like. Each one of these lines I am attempting to isolate the Collection-ID.Package-name and remove the.(Version)
DGL1PLAN_PUT_PFC.FCA#FKS.(CAD17_2013-01-30-21.35.29)
DSN8CC91.DSN8CLTC.(2015-01-14-16.33.06.616783)
DSNAOCLI.DSNCLICS.(UQ40167)
DSNJAR.DSNX9DIJ.(UK81051)
Into:
DGL1PLAN_PUT_PFC.FCA#FKS
DSN8CC91.DSN8CLTC
DSNAOCLI.DSNCLICS
DSNJAR.DSNX9DIJ
I have not figured out how to delete the lines, but I have figured out (I think) how to isolate them by themselves. I am currently using ^.*(?=..(CAD))
to highlight everything before the .()
on the lines. I am learning Regex and to my understanding and google searches:
^
is the beginning of the string
.
finds any character except newlines
*
finds 0 or more of the previous type
(
begins search
?=
is positive lookahead
..(CAD)
is the search term I used to get it to highlight the string I want to isolate
)
ends the search
I am unsure of how to delete the excess but have managed to highlight the portion I want to keep.
Here is an image of what I've figured out so far:
DGL1PLAN_PUT_PFC.FCA#FKS.(CAD17_2013-01-30-21.35.29)
and remove the timestamp, turning it intoDGL1PLAN_PUT_PFC.FCA#FKS
same with the 3 other lines.