Satimage's regex Question

In trying to parse some data from a string, I decided to use Satimage’s regxp addition. However, I’m having some issues with it that I can’t quite figure out. According to the documentation, the default regex engine is Ruby, which is great because it supports the lookbehind and lookahead and I can use those. I tested my regular expression in Ruby:

ruby-1.9.2-p290 :056 > ref = “ABCD_oxox">Reset”
=> “ABCD_oxox">Reset”
ruby-1.9.2-p290 :057 > xx = /.*(?=">)/.match(ref).to_s
=> “ABCD_oxox”
ruby-1.9.2-p290 :058 >

So I know it works. However, in AppleScript, I can’t seem to get it to work:

– AS Begin

set RefID2 to “ABCD_oxox">Reset”

set xx to find text “.*?(?=\">)” in RefID2 with regxp and string result

– AS end

error “No result was returned from some part of this expression.” number -2763

I’m stumped… anybody got a clue on this one?

Wayne

‘regxp’ should be ‘regexp’. :slight_smile:

:rolleyes: geez… I knew I should have put on my reading glasses this morning! Thanks Nigel. I knew that search string should have worked, just couldn’t figure out why it didn’t.

The giveaway for me was when I compiled the script and saw that ‘regxp’ was the wrong colour.

By the way, where you’ve written “-- AS Begin” and “-- AS end” in your post, if you replace them with the BBCode tags [applescript] and [/applescript], your code will appear in a box with a clickable link which opens the script in people’s preferred script editors. Or the “Applescript” button on the posting page can enter these tags for you.