I’m using Dreamweaver to replace a line of code that looks like this
123, //hotspot topValue
with a line of code that looks like this
[123, 123, 123], //hotspot topValue
I suck at regular expressions.. And what makes it even more difficult is that the number I need to keep unchanged is not always three digits but can be sometimes 0 too.
In that case it should go from
0, //hotspot topValue
to
[0, 0, 0], //hotspot topValue
So basically I always take the number on the line that is commented //hotspot topValue and put it inside an array and duplicate it two times.
Is this possible with regular expressions in the find and replace panel? I read that Dreamweaver uses Javascript regular expressions if it helps.
Have a look at dreamweaver’s documentation.
The regular expression you are looking for would be:
[0-9]+will match any number of characters0,1,2,..,9that occur at least once (+means one or more). Brackets around it will make it a capture group, meaning that you can then use any content matched inside them as$1. The rest is obvious: match exactly, //hotstop topValue.Alternatively you can use
To match your number followed by any comment (although one must be present).