help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Printing TITLE, SUBTITLE, and KEYWORDS


From: Greg Wooledge
Subject: Re: Printing TITLE, SUBTITLE, and KEYWORDS
Date: Sat, 4 Feb 2023 10:23:37 -0500

On Sat, Feb 04, 2023 at 04:05:13AM +0100, Hans Lonsdale wrote:
> > > >     pn_ere='^[[:space:]]*([#;!]+|@c|//)[[:space:]]+'
> > 
> > That does not AT ALL match the sample inputs you have been providing.
> > That's the main problem here.  You're working with inputs that only
> > you can see.
> 
> This is used to allow indentations in comments 

It does a HELL of a lot more than that.  Did someone else write that
regex for you?  Do you even understand it?

But OK, now we have ACTUAL CONFIRMATION that your needs are MORE COMPLEX
than your EXAMPLES have shown.

Your comments (which MAY OR MAY NOT be introduced by ##) may be
"indented", and apparently your indentation may be tabs, or spaces, or
a mix.

That means you really do NEED a regex.  String comparisons won't work.

So, you need to "escape" the strings that you are injecting into your
regex.  I showed one way of doing that, in a previous message.  I may
have missed some special characters.  Be on the lookout for that.

Escape your strings, inject them into the regex, and then use the regex
in your awk or sed program to do your parsing.

All of the tools you need have been provided already.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]