Hi,
Pret Orian said:
I did try the Michael's script and it did work indeed (thanx Michael).
However, I'm having a problem with "is" word standing on the beginning
of the string (or at the end). What would be a pattern that would
exclude all the characters that are not a-zA-Z except if beeing on the
beginning of the string
For example:
.pattern = "\bis\b"
Replaces: "this is something" "(is)" " This is." ...
But leaves "is this something" untouched.
Is there a way out?
Where are the escape characters (like \b) documented?
regards
I'm not much at regex, and maybe some one can post a simple regex addition,
but as a fallback, you could do the beginning and end issues with standard
string manipulation, after using Michael's regex script. It's kludgy, but
it works.
s1= "is this something? it is, it is"
' Michael's regex script
with new regexp
.global = true
.ignorecase = true
.pattern = "\bis\b"
s2 = .replace(s1,"<a href=is.htm>is</a>")
end with
'add
if lcase(left(s2 & " ", 3)="is ") then _
s2= "<a href=is.htm>is</a>" & mid(s2, 3)
if lcase(right(s2, 3)=" is") then _
s2= left(s2, len(s2) -2) & "<a href=is.htm>is</a>"
msgbox s1 & vbcrlf & s2
Joe Earnest