I'm trying to figure out a regex solution to get the following working on some files I have
[Clive Barker] Rawhead Rex.cbz
[Hastings] I Am Groot 001 (2017-)(FromAnime).cbr
[Robinson] Cable 001 (2017-)[FromAnime].cbr
My plan is to get
Clive Barker\[Clive Barker] Rawhead Rex.cbz
Hastings\[Hastings] I Am Groot 001 (2017-)(FromAnime).cbr
Robinson\[Robinson] Cable 001 (2017-)[FromAnime].cbr
however some have double backets and others don't and that where I hit my snag.
searching: ^\[(.*)\].*
replace with: $1\\$0
results in:
Clive Barker\[Clive Barker] Rawhead Rex.cbz
Hastings\[Hastings] I Am Groot 001 (2017-)(FromAnime).cbr
Robinson] Cable 001 (2017-)[FromAnime\[Robinson] Cable 001 (2017-)[FromAnime].cbr
I tried various combinations however i never can seem to get it group only the first set of brackets. It's always grouping basically the entire string even when encapsuling everything in parenthesis. tried combinations with only the first 20 characters, but failed to get that working. The point is i'm bad at regex.
MRT: a Regex question, how to do not match that many
Moderators: white, Hacker, petermad, Stefan2
MUT: a Regex question: how to match non-greedy
Use your .* expression in a non-greedy variant
An ? will switch-on the non-greedy operation:
searching: ^\[(.*?)\]
replace with: $1\\$0
An ? will switch-on the non-greedy operation:
searching: ^\[(.*?)\]
replace with: $1\\$0
Re: a Regex question
ugh see that's what I mean.... I'm bad at regex.
Thank you for the solution.
Thank you for the solution.