I have this snippet of code in yml:
- Item: Oldman's_Romance
Rate: 50
- Item: Grasshopper's_Leg
Rate: 8000
- Item: Azure_Jewel
Rate: 9000
- Item: Grasshopper_Doll
Rate: 1500
- Item: Angel's_Arrival
Rate: 1000
- Item: Center_Potion
Rate: 700
I want to change the values of "Rate" to be capped at 5000.
It would look something like this:
- Item: Oldman's_Romance
Rate: 50
- Item: Grasshopper's_Leg
Rate: 5000
- Item: Azure_Jewel
Rate: 5000
- Item: Grasshopper_Doll
Rate: 1500
- Item: Angel's_Arrival
Rate: 1000
- Item: Center_Potion
Rate: 700
If I understood correctly, what you want is to replace all the Rate
's that are above 5000 and change them into 5000.
I think that what you could do is search for
Rate: [5-9]\d{3}
And replace to
Rate: 5000
Explanation:
Rate:
I think this doesnt need explanation[5-9]
five to nine\d
Digits (zero to nine){3}
Has three digitsSo basically, lets search for strings that has Rate:
followed up by a number that must be five to nine, and then other 3 digits
Note: this only works for numbers above 5000 and below or equal 9999