I would like to ask for help on how to use Regex correctly. I am trying to extract access token on a txt file.
This is what I am trying to extract
I am using this syntax “System.Text.RegularExpressions.Regex.Match(result.TextContent, “(?<=access_token[””:\s]*)[A-Za-z0-9-_]+“).Value” but its only extracting the first 4 digits (1000).
Hey @mapaje you’ve to mark the correct answer as solution not yourself as a solution. If you want to be marked as solution then give the answers to the topics not just raise the topic and mark yourself as solution.
Your original regex pattern looks to be failing because you didn’t consider the “.” values in the token.
You just needed to update the square brackets with a “\.” The backslash is to escape the “.” in regex. You need to escape that character within the square brackets because “.” means any character.