Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General / December 2004



Tip: Looking for answers? Try searching our database.

Regular Expression: Help figuring out Pattern

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Faraz Azhar - 30 Dec 2004 09:21 GMT
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!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.