Reputation: 4007
I want to find text like },1{
},12{
and replace this with },{.
I need regular expression to match word like },digit{
.
I have tried this but its not matching exactly:
[^\}][^\,][^\d][^\{]
Upvotes: 1
Views: 311
Reputation: 6015
Try this \},\d+\{
replace with },{
as mentioned.
Should match for },{ exactly and any digits in between
This is faster than lookahead and takes fewer steps (13)
Demo: [ https://regex101.com/r/ciKbse/1 ]
as compared to 49 with lookaheads (?<=\},)\d+(?=\{)
[ https://regex101.com/r/cqlHCo/1 ]
Upvotes: 1
Reputation: 521279
Here is one way to do this using lookarounds. Try the following find and replace in regex mode:
Find: (?<=\},)\d+(?=\{)
Replace: (leave empty)
This regex targets one or more digits positioned as you described, and then replaces them with nothing, effectively removing them.
Upvotes: 2