I am new to regex,
Can anyone explain for me the patterns:
[a-fA-F\d]{30}
[\d\w]
[-+_~.\d\w]
[-\d\w]{0,253}
First of all, few notes:
\d is the shorthand to express any digit. [0-9] and character class [[:digit:]] are analogous to \d.
\w is the shorthand for all alphanumerics and _. [a-zA-Z0-9_] and [[:alnum:]_] are analogous to \w.
Now the Regex patterns:
[a-fA-F\d]{30} will match any of the characters among abcdefABCDEF0123456789 exactly 30 times.
[\d\w] will match any single character between [0-9] and [a-zA-Z0-9_]. Note that \w contains [0-9] so you don't need \d. Just use \w.
[-+_~.\d\w] will match any single character between -+_~.[0-9][a-zA-Z0-9_]. Note that \w alreadly contains _ and [0-9] so you don't need to explicitely mention _ and \d. This can be simplified as [-+~.\w]
[-\d\w]{0,253} will match any of the characters between -, [0-9] and [a-zA-Z0-9_] with a minimum of 0 to a maximum of 253 times. Again \d is not needed, you can use [-\w]{0,253}