[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Printing TITLE, SUBTITLE, and KEYWORDS
From: |
Hans Lonsdale |
Subject: |
Re: Printing TITLE, SUBTITLE, and KEYWORDS |
Date: |
Sun, 5 Feb 2023 07:26:32 +0100 (CET) |
> ----------------------------------------
> From: Greg Wooledge <greg@wooledge.org>
> Date: Feb 5, 2023, 3:23:37 AM
> To: <help-bash@gnu.org>
> Subject: Re: Printing TITLE, SUBTITLE, and KEYWORDS
>
>
> 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?
I did write it and understand it. It allows spaces before the comments and
spaces after.
Comments would be composed of ## or !! or @c or // for possibility of different
languages.
> 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.
--
Sent with https://mailfence.com
Secure and private email
- Printing TITLE, SUBTITLE, and KEYWORDS, Hans Lonsdale, 2023/02/03
- Re: Printing TITLE, SUBTITLE, and KEYWORDS, Dennis Williamson, 2023/02/03
- Re: Printing TITLE, SUBTITLE, and KEYWORDS, Greg Wooledge, 2023/02/03
- Re: Printing TITLE, SUBTITLE, and KEYWORDS, Hans Lonsdale, 2023/02/04
- Re: Printing TITLE, SUBTITLE, and KEYWORDS, Greg Wooledge, 2023/02/04
- Re: Printing TITLE, SUBTITLE, and KEYWORDS,
Hans Lonsdale <=