Extract substrings starting with known text from long lines

I’ve received a .csv report from TripWire logs, where each entry is a long text strings.
I needed to extract some substring from each row, e.g “ErrorCode: ABC1234” where preceding text is constant, but actual error code could be different.
In TSQL I can do someting similar using patIndex and substring, e.g.
select text,substring(TEXT,PATINDEX (‘%ErrorCode:%’,TEXT),10)

In C# I can do it using RightAfter and TrimLength from My StringHelper
RightAfter(Text,”ErrorCode:”).TrimLength(10)  

But I was able to do it In Visual Studio Editor using replace and tick ‘Use regular expressions”

Find what
^.*ErrorCode:
replace with
ErrorCode:

I would appreciate suggestions to do similar extracts using other tools.

Related post

Remove empty lines in text using Visual Studio.

Advertisements