Reputation: 65
I have the following code in a HTML page:
src="/images/picture1.gif" ONMOUSEOVER="itempopup(event,'69168298'
src="/images/picture2.gif" ONMOUSEOVER="itempopup(event,'69168223'
src="/images/picture3.gif" ONMOUSEOVER="itempopup(event,'69168243'
src="/images/picture4.gif" ONMOUSEOVER="itempopup(event,'69168249'
src="/images/pic1.gif" ONMOUSEOVER="itempopup(event,'69168249'
src="/images/pictures10.gif" ONMOUSEOVER="itempopup(event,'69168249'
and I want to build a Map with words of gifs that have picture+number -> {picture1=69168298, picture2=69168223 ...} I've tried to capture the word picture+number but I didn't found the right combination. Examples: ^(picture.)+$ , ^((picture).)+$, ^(?'picture'.)$. Thanks in advance!
Upvotes: 0
Views: 47
Reputation: 1790
With something like this :
/(picture[0-9]+).*'([0-9]+)'/
you will capture "picture1" and "69168298"
Upvotes: 1
Reputation: 32197
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
The regex above will also match cases in your example such as pic1
and pictures10
, and even pics123
Upvotes: 1