Help with Regex

I am trying to extract a token from a string that is pulled from a website. The string is as follows:

{"token":"eyJ0eXAiOiJKV1QsLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwicHJlZk5hbWUiOm51bGwsImxhc3ROYW1lIjoiQ29wZSIsInNjb3BlcyI6WyJjb250YWN0Il0sImlhdCI6MTQ0MzQ4MzI5NSwiZXhwIjoxNDQzNDg2ODk1fQ.qs2YDok1-eQpIpPUL4KaHznoOwKlIPDxhNXhDv052ZA","name":"cueToken"}

I am able to get this output: eyJ0eXAiOiJKV1QsLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwicHJlZk5hbWUiOm51bGwsImxhc3ROYW1lIjoiQ29wZSIsInNjb3BlcyI6WyJjb250YWN0Il0sImlhdCI6MTQ0MzQ4MzI5NSwiZXhwIjoxNDQzNDg2ODk1fQ.qs2YDok1-eQpIpPUL4KaHznoOwKlIPDxhNXhDv052ZA"

With this expression: (?<="token":").*?"

I want to remove that last double quote without having to use string slicing. Any help would be greatly appreciated.

by Jimmineee via /r/csharp

Leave a Reply