ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I can separate x and y perfectly, I just can't separate the green and red parts. I haven't thought of using Text::Balanced for this, I will try and report back.
I can separate x and y perfectly, I just can't separate the green and red parts. I haven't thought of using Text::Balanced for this, I will try and report back.
Then why/what for have we been discussing Text::Balanced in the first place ?
And, of course, just one pair (no nesting) of any type of brackets can be parsed by regular expression, but don't reinvent the wheel - Text::Balanced does this already.
Then why/what for have we been discussing Text::Balanced in the first place ?
And, of course, just one pair (no nesting) of any type of brackets can be parsed by regular expression, but don't reinvent the wheel - Text::Balanced does this already.
This is a different situation here then the one I was discussing earlier. Here I want to split the string at the first left bracket and don't care about nesting, before I was talking about finding the location of the corresponding right bracket.
And I still will need to do that to find the text to feed into process_pstruct().
And then how do I replace the original text with the one retured by process_pstruct()?
This is a different situation here then the one I was discussing earlier. Here I want to split the string at the first left bracket and don't care about nesting, before I was talking about finding the location of the corresponding right bracket.
And I still will need to do that to find the text to feed into process_pstruct().
And then how do I replace the original text with the one retured by process_pstruct()?
A general answer to the item in bold:
if you use regular expressions, there are predefined Perl variables which hold the part before match, the matching part and, I think, the remainder, but remainder can always be constructed from the whole test, part before match, and match; anyway, see below on 'length' and 'substr';
if you are using Text::Balanced, you definitely have $prefix, $extracted, $remainder - conceptually the same as above;
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.