Hi I need a regular expression that’ll give me something like this part
./something\", [something.sh
from something like this string
("./something\", [something.sh", ["./something\", [something.sh"], [/* 37 vars */])
is that possible? I’m having real trouble making this since there’s that \” escape sequence and also that ‘,’ character, so I cannot simply use match everything instead of these characters.
I’m working on unix so it’s also possible to use pipeline of few greps or something like that.
Thanks for advice.
With Perl you can use Text::Balanced which has an
extract_quotelikefunction to do what you need.You can do it manually with:
Basically: starting from a quote, if you see a
\, grab the next character (even if it’s a quote), else continue until you see a quote.