in reply to Re: string substitution
in thread string substitution

That worked perfectly. Thank you. I have a twist to add, though. After creating the initial regexp, I want to now check for the letter 'q' in the input string. For each 'q' found, I want to append (for example, with a 'q' in the fourth character of the input line) to the regexp:

' | grep -v ...5......'
So now, instead of a positive match, I want to check for a negative match (and if I understand regexes, I would need to add that string for each 'q' found in the input line).

Replies are listed 'Best First'.
Re^3: string substitution
by LanX (Saint) on Feb 23, 2022 at 12:52 UTC
    You should at least provide valid data in the sense of an SSCCE, your description is cryptic.

    Anyway, ISTM you want a character class [^5] in the regex to match anything but 5.

    Please expand the code provided to your needs, and show us what you tried.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery