Re: trimming + grep + applescript

2017-04-15 Thread Jean-Christophe Helary
Thank you all for the replies. > On Apr 16, 2017, at 5:53, Christopher Stone > wrote: > > A) Correct regex syntax (which Bruce kindly provided). Sorry, my regex was indeed about removing stuff at the beginning *only* and since I could not figure how to make that

Re: Speeding up multi-file search

2017-04-15 Thread Kerri Hicks
On Fri, Apr 14, 2017 at 7:06 PM, Ted Toal wrote: > I use multi-file search quite a bit, usually to search files of a > particular type, say *.R. I use a *.R filter, but the search is extremely > slow (I have projects located on mounted remote drives, and the project >

Re: trimming + grep + applescript

2017-04-15 Thread Christopher Stone
On 04/15/2017, at 07:44, Jean-Christophe Helary > wrote: > It looks like I'm trying to reinvent the wheel, but I can find a way to do > this: > > 1) replace ^\s with nothing > 2) replace \s$ with nothing > > in a

Re: trimming + grep + applescript

2017-04-15 Thread Bruce Van Allen
On 4/15/17 at 7:23 AM, b...@cruzio.com (Bruce Van Allen) wrote: That pattern matches zero or more spaces/tabs ADDED: It also removes blank lines. If you were concerned exclusively with spacebar spaces, change the pattern to "(^ *| *$)" Or, remove spaces and tabs using "(^[ \t]*|[ \t]*$)"

Re: trimming + grep + applescript

2017-04-15 Thread Fletcher Sandbeck
I'm not sure whether BBEdit's find/replace can be used in that way. The commands normally trigger the find/replace to occur within the specified open text document. This command removes all the white space from the beginnings of lines in the frontmost document. tell application "BBEdit"

Re: trimming + grep + applescript

2017-04-15 Thread Bruce Van Allen
Hi, This works over here: tell application "BBEdit" activate set pathstring to "/Users/me/Desktop/testfile.txt" replace "(^\\s*|\\s*$)" using "" searching in text of pathstring options {search mode:grep, starting at top:true, wrap around:true} end tell That pattern matches zero

trimming + grep + applescript

2017-04-15 Thread Jean-Christophe Helary
It looks like I'm trying to reinvent the wheel, but I can find a way to do this: 1) replace ^\s with nothing 2) replace \s$ with nothing in a single string The following lines don't work, because of the "^": set pathstring to " /path/to/my file.stuff " tell application "BBEdit"