I have a BBCode quote tag that is formatted like this:
[quote=Username;123456]
The delimiter is always there. How can I only match the digits with a regular expression (PHP)?
One way (among others):
\[[^\d\[\]]+(\d+)\]
\[ # match an open bracket
[^\d\[\]]+ # match anything not brackets or digits
(\d+) # capture digits to group $1
\] # match a closing bracket
Your digits will be in group $1
.