Quicksilver action to run a regex on input text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using terms from application "Quicksilver" | |
on get direct types | |
return {"NSStringPboardType"} | |
end get direct types | |
on get indirect types | |
return {"NSStringPboardType"} | |
end get indirect types | |
-- thirdPaneStuff is optional | |
on process text textToSearch with regex | |
try | |
-- Fix newlines https://stackoverflow.com/a/882136 | |
set regexResult to do shell script "/opt/homebrew/bin/perl -pe 's/\\R/ | |
/g' <<< " & quoted form of textToSearch & " | /opt/homebrew/bin/perl -pe " & quoted form of regex | |
tell application "Quicksilver" to set selection to regexResult | |
on error a number b | |
activate | |
display dialog a with title "error with your QS action script" | |
end try | |
end process text | |
on get argument count | |
return 2 | |
end get argument count | |
end using terms from |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment