Using Regex, I need to find a word within a encoded url query string which matches start with specific char % and word must be 3 chars length long including starting specific char %.
A sample is following:
Sam+JS%2C+COSP+Lepar-+Happy+Search+%28ENG%29+%5B320kbps%5D+%5B2019%5D+%7BYMB%9D
First char would always be
%Second char would always be a number
[0-9]Third char would be either a
numberOR analphabet(either in small or caps)
Result from above sample like be:
%2C %28 %29 %5B %5D %5B etc..
Hope problem is very clear.
>Solution :
Your regex should be something like that
['%']{1}[0-9]{1}[a-zA-Z0-9]{1}
Explain the code:
['%']{1} => matches the character %
[0-9]{1} => matches a single character in the range between 0 and 9
[a-zA-Z0-9]{1} => matches a single alphabet character or number between 0 and 9
You could build and test regex on regex101
