Take a current String before "\"

Hello Friends, I need I help… I would like take only name in my folders… soo I take a path folder:

Exmple: String = " Diego Pinheiro\2015\01\111 "
I need take all that comming before first " \ " soo I will need take = " Diego Pinheiro " And this Name can change, soo I need take all comming befores of first " \ ".

Somebody can help me pls?

thx!

Hi,

Can you try the following expression?

System.Text.RegularExpressions.Regex.Match(text,"[^\\]+").Value

or

text.Split({"\"c})(0)

Regards,

3 Likes

Hello

Will the second folder group always be a year?

If so, try this Regex Solution:
(.+)(?=\\2)
Regex 101 link
image
image

1 Like

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