tell application "BBEdit"
try
tell first document of front window
set vSelectionEnd to (characterOffset of its window's selection) - 1
set vRegex to "\\\\[A-Za-z0-9_ \\s]*(?:\\s+\"[^\"]*\")?\\s*(\\[(?:[^\\[\\]]+|(?1))*\\])(?:(\\s*=\\s*)(?P<function_name>[a-zA-Z0-9_!?]+))?"
set vOptions to {search mode:grep, wrap around:false, backwards:true}
set vResult to find vRegex searching in it options vOptions
if vResult's found then
set vSelectionStart to characterOffset of vResult's found object
else
error "Pattern not found."
end if
select its characters vSelectionStart thru vSelectionEnd
end tell
on error aMessage number aErrorNumber
if aErrorNumber ≠ -128 then -- Error number -128 (User Cancelled).
display dialog aMessage
else
return
end if
end try
end tell
\section [main]
\config "default settings" [database] = connect
\path [logs]
\module [auth[user]] = login_handler
\service [web_server] = nginx
\handler "error pages" [404[custom]] = not_found!
\backup [files] = backup_job
\system [network[tcp[port]]] = handle_connections?
\data "user info" [profiles] = user_manager
\temp [cache[memory[buffer]]] = cache_clear!
--
This is the BBEdit Talk public discussion group. If you have a feature request or believe that the application isn't working correctly, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Mastodon: <https://mastodon.social/@bbedit>
---
You received this message because you are subscribed to a topic in the Google Groups "BBEdit Talk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/bbedit/GGeHrjKwjkk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to bbedit+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/bbedit/d6ec7d50-afef-4339-a18e-71791f5cb216n%40googlegroups.com.