That looks like
foo(\+.*?)?#
(Using .*? instead of .* ensures that if you have a line like "foo+bar#
foo+mung#", it will match two occurrences, "foo+bar#" and "foo+mung#", rather
than a single occurrence with foo followed by the string "bar# foo+mung"
followed by #.
Regards,
Neil Faiman
> On Feb 12, 2021, at 7:07 AM, @lbutlr <[email protected]> wrote:
>
> I seem to be having a Brain Cloud¹ moment, but I am trying to match a pattern
> like this:
>
> foo+(anything)# or foo# and NOT match
>
> foobar#
> foobar+(anything)#
> foob#
> foob+(anything)#
> etc
>
> foo+# is invalid and cannot occur in my dataset.
>
> Basically, the + is optional, but if it is there, I have to account for
> anything after the + up to the # but not account for anything after foo
> unless the + is there.
>
> I started with foo\+?.*# but that obviously failed and now I'm looking at it
> and it's 0500 and I should've been in bed 7 hours ago.
>
> And yes, I am going to feel real stupid.
>
> 1. 🌋
>
> --
> I want to secede, but I don't know what state I'm in. - Bart Simpson, 2012
>
> --
> This is the BBEdit Talk public discussion group. If you have a feature
> request or need technical support, please email "[email protected]"
> rather than posting here. Follow @bbedit on Twitter:
> <https://twitter.com/bbedit>
> ---
> You received this message because you are subscribed to the Google Groups
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/bbedit/82052BB3-5773-4E7C-9E6D-6894047AE2F8%40kreme.com.
--
This is the BBEdit Talk public discussion group. If you have a feature request
or need technical support, please email "[email protected]" rather than
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/bbedit/95E94605-6109-411B-B9F7-8FB01125202B%40faiman.org.