Reputation: 2719
In my project, I have a situation in that some specific variables are assigned to numbers, but due to requirements, I have to change the numbers to a string.
For example, my original variable is like
question: 123
And I want to change it to
question: '123'
However, the var name is always the same what changes is the number so the match should be like
where question:
check if the number has '' if not add around the number the ''
I was wishing for a regular expression for it as I have so many variables to change that manually is not easy, but I'm not good with RegEx
I'm also open to different suggestions if any no need mandatory a RegEx if there is a better solution to my issue
Upvotes: 1
Views: 6445
Reputation: 101
You can do this as following:
.*
button to enable regexquestion: ([0-9]+)
question: '$1'
Each occurence of question: <ANY NUMBER>
will be replaced by question: '<ANY NUMBER>'
Upvotes: 4