Increasing a number in a file name
Hi! As far as I can see, the addon ignores file names when implementing the Increase/Decrease URL feature. For example, here is a path to a cat picture: https://thechive.com/wp-content/uploads/2022/10/h14CA4239.jpg?attachment_cache_bust=4213044&quality=85&strip=info&w=600 Now, I perform the Increase URL gesture trying to get /h14CA4240.jpg; but I get this: https://thechive.com/wp-content/uploads/2022/10/h14CA4239.jpg?attachment_cache_bust=4213044&quality=85&strip=info&w=601 Ok, I get rid of the parameters and apply the gesture to https://thechive.com/wp-content/uploads/2022/10/h14CA4239.jpg, but this time I get this: https://thechive.com/wp-content/uploads/2022/11/h14CA4239.jpg
Is this a bug or a feature? If feature, why?
Your System
- Operating system: Win10x64
- Firefox version: 103
- Gesturefy version: 3.2.6
Hi, this is the expected behaviour.
The first example is due to the fact that the last number match found in the URL is the one that gets incremented/decremented.
The reason for the second one is that the file name doesn't match as a number, because it contains letters and special characters. The default regex looks for complete numbers between slashes like /123/ and query parameters ?p=123 This is done in order to avoid matching number occurrences that most likely cannot/shouldn't be changed.
If you are familier with regex, you probably want to create your own. The default regex has become a bit clumsy but you can find it here.
Thanks. I'll have to master some skills to do this, but I'm probably not likely to find this feature in another addon, so have to dive in...
If you just want to match the last number occurrence anywhere in the URL you can use (\d+)(?!.*\d)