Seeking better way to replace 1st match using regular expression

I’m writing a script to go through highlighted text in a text file, find the first reference of a term that’s not within a hyperlink, and then add a hyperlink.

I’ve got the regular expression:

set regex to "\\b(" & my_item & ")\\b(?!(?:(?!<a.*?>).)*?a>)"
set replacement to "<a href=\"" & my_replacement_item & "\">\\1</a>"

but I don’t know how to do the replace for just the first match. As far as I can tell, the Satimage osax regexp function will only replace all matches; you can’t restrict it to first match.

I ended up using TextWrangler

tell application "TextWrangler"
		activate
		find regex searching in text 1 of text document 1 options {search mode:grep, starting at top:true, wrap around:false, backwards:false, case sensitive:true, match words:false, extend selection:false} with selecting match
		set x to find regex searching in text 1 of text document 1 options {search mode:grep, starting at top:true, wrap around:false, backwards:false, case sensitive:true, match words:false, extend selection:false} with selecting match
		if found of x is true then
			set selection of window 1 to (grep substitution of replacement)
		end if
	end tell

but I’d very much like to find another way that doesn’t depend on TextWrangler. Shell command? Perl? Thanks for any suggestions and syntax help.