The question mark after the + makes it non-greedy so it won't match the 
character immediately following. However, in this case you're matching until 
the end of the line so I don't think it does anything.

Compare these two patterns matched against the input. The ? after the + 
prevents the match from slipping out of the quotation marks.

Input: I see a "cat" and "dog".

Pattern: ".+?" 
Matches: "cat"

Pattern: ".+" 
Matches: "cat" and "dog"

The "Pattern Playground" in BEdit 13 on the Search menu is a good tool for 
playing around with patterns since it shows you what's being matched explicitly.

[fletcher]


> On Dec 19, 2019, at 8:58 AM, Howard <leadwithlo...@gmail.com> wrote:
> 
> I am new both to BBEdit and to GREP and have a question about this GREP code:
> 
> \\.+?$
> 
> It is used in Search's Find box to remove all text from the backslash on, and 
> is accompanied by no value in the Replace box.
> 
> Sample Input
> Tyler Rogers\rogerty01
> 
> Desired Output
> Tyler Rogers
> 
> I understand that the two backslashes seek the backslashes in my text, that 
> the "." seeks "any character except a ‘hard’ line break" after the backslash, 
> and that the "$" continues the search to the line's end. But what does the 
> question mark do?
> 
> Howard
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a 
> feature request or need technical support, please email
> "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter: <https://twitter.com/bbedit 
> <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 bbedit+unsubscr...@googlegroups.com 
> <mailto:bbedit+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/c59021ba-c7aa-4790-af66-dfd5fba423fa%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/bbedit/c59021ba-c7aa-4790-af66-dfd5fba423fa%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
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 bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/A4831696-D7F9-40D3-ADEA-063FDAC685CF%40cumuli.com.

Reply via email to