That is because your limiting the string using the ^$
characters. Just do it as follows:
(pic(ture)?s?\d+).*?event,'(\d+)'
And the \1
and \3
captured groups will contain the picture name and event id respectively
Demo
The regex above will also match cases in your example such as pic1
and pictures10
, and even pics123