On 17/10/2012 23:10, Oliver Taylor wrote:
> Is it possible to test the found text*of* nextChar as regex?
>
> If you can point me in the right direction, I'd be grateful.
>
> *tell* /application/ "BBEdit"
>
>
> --look at the next character
> *set* nextChar*to* *find*"." searching in/text/*of* *front* /text
> window/options{search mode:grep, wrap around:false}
>
>
> *if* found text*of* nextChar= " " *then* --should also test for
> punctuation
You don’t need to use regular expressions but rather do something like this:
tell application "BBEdit"
set _matched_chars to {space, tab, "\"", "'"} -- etc.
set _nextchar to (characterOffset of selection)
tell the text in the front text document
set _char to (character _nextchar as string)
if _char is in _matched_chars then
------
end if
end tell
end tell
--JD