From what I see with your results, I think this is getting me to the place of "good enough" for this problem. Also, really helping me understanding programming concepts better which is good because I have an idea I want to attempt to program (long road I see). So the embarrasing part, I've tried to take your text and make a shell script to place in the script folder. I followed directions from a tutorial that had me run a command from terminal to make the text into a script:
chmod +x ~/somecrazyfolder/script1 I ran that (with appropriate path and file names) and I get the error in terminal "No such file or directory" tutorial from here: https://www.howtogeek.com/67469/the-beginners-guide-to-shell-scripting-the-basics/ I then tried it in the apple script editor, plugged your text below into there and then saved it as a .scpt. Then I placed that filed in the BBedit directory. I can now go to menu-text-apply text filter and see it, but when I run it I get the error message in BBedit "This Apple Event was unknown to the recipient and could not be processed (macOS error code: -1708)." Do scripts need to be made from terminal, or will Apple script work with this? *Again, thanks for your time*, I'm sure the daunting initial hurdles will start to make more sense. This whole text was the correct format to make a script from without Perl right? #!/usr/bin/env perl -0777 -sw use v5.12; use utf8; my $text = <>; my @array = $text =~ /(\b\w[^.!]+?\?)/gms; $, = "\n"; say @array; On Monday, December 31, 2018 at 4:03:49 PM UTC-8, Christopher Stone wrote: > > On 12/31/2018, at 13:54, Dj <[email protected] <javascript:>> wrote: > > Mike, that makes a lot more sense now. I looked at page for the Module and > it seems it's run from terminal and OSX has perl pre-installed? > > ------------------------------ > > Hey Dj, > > BBEdit can run shell scripts as Text-Filters, and they do *not* need to > be run from the Terminal. > > BBEdit text-filters operate on the selection if there is one, otherwise > they operate on the whole front document. > > Text filters are installed here: > > ~/Library/Application Support/BBEdit/Text Filters/ > > Text filters are run from: > > BBEdit Menu Bar > Text > Apply Text Filter > <your_filter> > > And of course you can give them keyboard shortcuts in BBEdit's Menus & > Shortcuts preferences. > > http://www.bbeditextras.org/wiki/index.php?title=Text_Filters > > See the User Manual for more details. > > Or is it a "module" than can be run somehow from within BBEdit? > > > Perl comes pre-installed on macOS, although it's usually a fairly old > version. > > The module Mike recommends is something you the user have to install, and > that's probably more complication than you want to mess with. > > For that matter it doesn't really do the job in and of itself. It > requires additional coding. > > A Perl script using the Lingua module that'll run as a BBEdit Text Filter > would looks something like this: > > ------------------------------ > > #!/usr/bin/env perl -0777 -sw > use v5.12; > use utf8; > use Lingua::EN::Sentence qw( get_sentences add_acronyms ); > > my $text = <>; > > add_acronyms('lt','gen'); ## adding support for 'Lt. Gen.' > my $sentences = get_sentences($text); ## Get the sentences. > > foreach my $sentence (@$sentences) { > if ( $sentence =~ /(\b\w[^.!]+?\?)/ ) { > say $1; > } > } > > ------------------------------ > > It produces this: > > —Eskimo proverb What can be added to the happiness of man who is in > health, out of debt, and has a clear conscience? > —Adam Smith Do you prefer that you be right, or that you be happy? > What am I doing right? > —Tom Walsh Why not seize the pleasure at once? > How often is happiness destroyed by preparation, foolish preparation? > Unhappiness Is anyone in all the world safe from unhappiness? > —Vauvenargues Why is it that so many people are afraid to admit that they > are happy? > —Maurice Maeterlinck Who is the happiest of men? > Da vies Is life so wretched? > Isn't it rather your hands which are too small, your vision which is > muddled? > —Marcus Cato the Elder If you haven't forgiven yourself something, how can > you forgive others? > —Mark Twain How shall I love the sin, yet keep the sense, And love the > offender, yet detest the offence? > —George Macdonald Who would care to question the ground of forgiveness or > compassion? > —Socrates Who Is Really Poor? > —Japanese proverb Who Is Really Rich? > —Colette Was it always my nature to take a bad time and block out the good > times, until any success became an accident and failure seemed the only > truth? > Next to what? > > ------------------------------ > > Which is nearly the same result as my plain regular expression. > > I can accomplish the same result as the script using the Lingua module > without using it: > > ------------------------------ > > #!/usr/bin/env perl -0777 -sw > use v5.12; > use utf8; > > my $text = <>; > my @array = $text =~ /(\b\w[^.!]+?\?)/gms; > $, = "\n"; > say @array; > > ------------------------------ > > Perl is a wonderful tool for parsing text, but learning it requires a > pretty sizable investment. > > -- > Best Regards, > Chris > > > -- 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 to the group. Follow @bbedit on Twitter: <https://www.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 post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/bbedit.
