Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regex

Status
Not open for further replies.

GaryC123

Programmer
Sep 10, 2002
1,041
NO
How do i create a regular express to search for something like this <dsfdsfdsfds>
where I want to find data within the <> tags

Just need the expression to use



 

_________________________________________________________
for the best results to your questions: FAQ333-2924
01001111 01101110 01110000 01101110 01110100
onpnt2.gif
[/sub]
 
Yeah saw that but cant get it to work, here is what i have

Sub RegExpRep(Phrase)
Set objRegEx = New RegExp
objRegEx.Global = True
objRegEx.IgnoreCase = True
objRegEx.Pattern = &quot;<(.|\n)+?>&quot;

Set Matches = objRegEx.Execute(Phrase)

For Each Match in Matches
Response.Write Match.value
Next

End Sub


strPath = Server.MapPath(&quot;test1.html&quot;)
Set objFSO = CreateObject(&quot;Scripting.fileSystemObject&quot;)
Set objTextStream = objFso_OpenTextfile(strPath)


tempHTML= objTextStream.readall


RegExpRep temphtml



 
GaryC123

it doesn't quite work that way. you're trying to write HTML tags to the screen but they will indeed not be written to the screen but interpruted by the browser and set back as regular HTML tags. reaplce the < > with chr codes to see what I mean. either that or that is jsut where your confusion is and what you have is what you want

_________________________________________________________
for the best results to your questions: FAQ333-2924
01001111 01101110 01110000 01101110 01110100
onpnt2.gif
[/sub]
 
change your response.write to read
response.write replace(replace(Match.Value,&quot;<&quot;,&quot;&quot;),&quot;>&quot;,&quot;&quot;)

then you'll see what I mean

_________________________________________________________
for the best results to your questions: FAQ333-2924
01001111 01101110 01110000 01101110 01110100
onpnt2.gif
[/sub]
 
That worked great. Now say some of the emails are seperated by spaces or '
Is it possible to include that in the code or would I have to repeat the process for each variation



 
emails?? what is the script being used for and where do the spaces and ' come into the picture?

_________________________________________________________
for the best results to your questions: FAQ333-2924
01001111 01101110 01110000 01101110 01110100
onpnt2.gif
[/sub]
 
so your data is stored as
<blah@blah.com>
<blah@blah.com>
'blah@blah.com'

or is it

<>blah@blah.com<>blah@blah.com'blah@blah.com'


hoestly to make things easy on myself if I had to perfomr this task I would just replace the ' instances with the <> before running the reg pattern match on it.

_________________________________________________________
for the best results to your questions: FAQ333-2924
01001111 01101110 01110000 01101110 01110100
onpnt2.gif
[/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top