String split between two words

Hello,
I am triyng to get the key value from following string.
I don’t know how to split.I tried some of the other topics from forum but couldn’t manage it.

2019-07-30_162751
Any Ideas?
Thanks in advance!

@dcrt Try below regex method.

 System.Text.RegularExpressions.Regex.Match(var,"(?<=Key).+(?=StartTime)",RegexOptions.Singleline).ToString.Replace("""","").Replace(":","").Trim

Here var is string variable which contains your data

1 Like

Hi
Hope this step could help you resolve this
If the above text is stored in a string variable named intext
The
outtext = intext.Tostring.SubString(intext.IndexOf(“””Key”””)+6,intext.IndexOf(“””StartTime”””)-intext.IndexOf(“””Key”””))

Cheers @dcrt

@dcrt
Can you please provide the text as editable/coupyable, as it will easy to work on it.
Also, 1. does the value you want to extract always appear at same place in the text you shared?
2. Is it of same length each time?

This expression may be helpful too:
image

1 Like

Thank you all for your answers. I have tried @Palaniyappan s solution and it worked.

1 Like

Cheers @dcrt

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.