Re: add # comment to python code

2023-09-21 Thread Bruce Van Allen
\s* stands for zero or more whitespace characters, including \n and \r 
(newlines).

Two ways (at least) to get what you want:

1. Instead of \s, use a character class. [ \t] defines a character class with a 
spacebar space and a tab.

* All of these start at beginning of line due to ‘^’ anchor.

  ^[ \t]*print # zero or more spaces or tabs before ‘print’ 

  ^[ \t]print  # one tab or space before ‘print'

  ^[ \t]+print # one or more spaces or tabs before ‘print'


2. Use \h instead of [ \t] or \s; \h stands for horizontal whitespace, applies 
more widely to horizontal whitespace characters.

  ^\h*print

  ^\hprint

  ^\h+print

HTH

— Bruce

_bruce__van_allen__santa_cruz_ca_





> On Sep 20, 2023, at 8:40 PM, John Mitchell  wrote:
> 
> my search string is:  ^\s*print
> my replace string is:  #\0
> 
> however it goes over the end of a blank line to connect with a next "print..."
> How do I stop the multiline operation?
> 

-- 
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 here. Follow @bbedit on Twitter: 
--- 
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/4527CCE8-579E-42FD-A393-465F14A95132%40cruzio.com.


Re: add # comment to python code

2023-09-21 Thread Rich Siegel
On 20 Sep 2023, at 23:40, John Mitchell wrote:

> my search string is:  ^\s*print
> my replace string is:  #\0
>
> however it goes over the end of a blank line to connect with a next
> "print..."
> How do I stop the multiline operation?

You can use a (?-s) at the beginning of the pattern.

Or you could use the "Un/Comment" command on the Text menu. :-)

Enjoy,

R.

-- 
Rich Siegel Bare Bones Software, Inc.
  

Someday I'll look back on all this and laugh... until they sedate me.

-- 
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 here. Follow @bbedit on Twitter: 
--- 
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/9BDAA606-7CB3-463C-B441-3AEE2471230B%40barebones.com.


add # comment to python code

2023-09-21 Thread John Mitchell
my search string is:  ^\s*print
my replace string is:  #\0

however it goes over the end of a blank line to connect with a next 
"print..."
How do I stop the multiline operation?

tia

-- 
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 here. Follow @bbedit on Twitter: 
--- 
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/69a152c3-6f15-4cc5-9623-8598b0fa5690n%40googlegroups.com.