Hello,
I need a little help figuring out the Pattern property of Regular
Expressions. Im trying to search a document loaded in a textbox. The search
has to contain the following flags: Match Case, and Find Whole Word Only.
The 'Match Case' can be set from IgnoreCase property. But I am unable to
create the Pattern for 'find whole word only'. How to write it?
Thank you very much!
Faraz Azhar - 30 Dec 2004 10:03 GMT
ok sorry i shouldve searched before posting this. I found the
solution... its:
Pattern = "\b" & searchstring & "\b"
But another problem: I use the following code to strip out all the html
tags:
Pattern = "<\S[^>]*>"
It works well but one drawback is that it leaves out all the
javascripts in the page (because they are liek <SCRIPT> ..... </SCRIPT>
and this Pattern only strips out SCRIPT tags) .. how can I eliminate
the complete SCRIPT tags? also this would also apply in STYLE tags
(more preferrably i want to skip out whole HEAD tag)
Gary Nelson - 30 Dec 2004 10:06 GMT
Faraz,
How about trying InStr()?
Gary
> Hello,
>
[quoted text clipped - 6 lines]
>
> Thank you very much!
Faraz Azhar - 31 Dec 2004 04:51 GMT
that would be good... but i was keeping that to an alternative. i thought
RegExp had this power to detect stringss from one end to another. I wanted
to detect SCRIPT tags and their material starting from <SCRIPT> ... to ...
</SCRIPT>. I found a way to do it:
rExp.Pattern = "<script\S[^>]*>"
but it fails where there is Language parameter.. (eg. <SCRIPT
LANGUAGE="VBSCRIPT">...</SCRIPT>) .. if there is Language inside the
script.. it only detects the complete starting script tag, not the /SCRIPT
tag.
If anyone knows the solution lemme know, otherwise its back to InStr then..
:)
> Faraz,
>
[quoted text clipped - 12 lines]
> >
> > Thank you very much!