I have a reg exp pattern as below works fine for the string : <param name="url" value="contents/cf_intro.htm" valuetype="ref">
mObjRegExp.pattern="<param.+?value=""([^""]+)""
But the same is not working for
<param name="url" valuetype="ref" value="../fmmain/fmindex.htm"
note that, i want to capture the url that comes after value=". if the value=" comes in the second place in the html tag it works. but if it comes in the 3rd position, then it doesn't work.
Can anyone help me finding the problem and make it work for both?thanks in advance. 5 1424
"Raj.SB" <sgmuser#rediffmail.com> wrote in message
news:E4**********************************@microsof t.com... I have a reg exp pattern as below works fine for the string : <param
name="url" value="contents/cf_intro.htm" valuetype="ref">. mObjRegExp.pattern="<param.+?value=""([^""]+)"""
But the same is not working for
<param name="url" valuetype="ref" value="../fmmain/fmindex.htm">
note that, i want to capture the url that comes after value=". if the
value=" comes in the second place in the html tag it works. but if it
comes in the 3rd position, then it doesn't work. Can anyone help me finding the problem and make it work for
both?thanks in advance.
What does "not working" mean? Please show more code. I tested the
regular expression you provided and it behaves as expected.
Hi Thanks for the reply first
Not working means, the reg exp does not return the url in between the quotes after 'value=' from the following string
<param name="url" valuetype="ref" value="../fmmain/fmindex.htm"> . it works for this string
<param name="url" value="contents/cf_intro.htm" valuetype="ref">
the only difference between these two is the string i try to capture comes second in the working one, but in the not working string it comes as the third. am i explaining it clearly?
<%
strLine = "<param name=""url"" valuetype=""ref"" value=""contents/cf_intro.htm"">" 'will return nothing
strLine = "<param name=""url"" value=""contents/cf_intro.htm"" valuetype=""ref"">" 'will return 'contents/cf_intro.htm'
Set mObjRegExp = New RegExp
mObjRegExp.IgnoreCase = True
mObjRegExp.MultiLine = True
mObjRegExp.Global = True
If InStr(lcase(strLine),"<param name=""url"" value=") Then
Response.write "StrLine(PARAM):"&strLine&"<BR>"
'mObjRegExp.pattern="<param.+?value=""([^""]+)"""
Set mObjMatches = mObjRegExp.Execute(strLine)
If mObjMatches.Count = 0 Then
Else
DescriptionParam = mObjMatches.item(0).Value
If Len(DescriptionParam) > 5 Then
DescriptionParam = Mid(DescriptionParam, InStr(1,DescriptionParam, "value=""", vbTextCompare) + 7)
DescriptionParam = Mid(DescriptionParam, 1, InStr(1, DescriptionParam, """", vbTextCompare)-1)
ParamFlag = 1
Else
ParamFlag = 0
End If
End If
Else 'Checking for Param applet links
End If 'Checking for Param applet links
Set mObjMatch = Nothing
Set mObjMatches = Nothing
Set mObjRegExp = Nothing
Response.write "<BR>test : " & DescriptionParam & "<BR>"
%>
"Raj.SB" <an*******@discussions.microsoft.com> wrote in message
news:0B**********************************@microsof t.com... <% strLine = "<param name=""url"" valuetype=""ref""
value=""contents/cf_intro.htm"">" 'will return nothing strLine = "<param name=""url"" value=""contents/cf_intro.htm""
valuetype=""ref"">" 'will return 'contents/cf_intro.htm' Set mObjRegExp = New RegExp mObjRegExp.IgnoreCase = True mObjRegExp.MultiLine = True mObjRegExp.Global = True
If InStr(lcase(strLine),"<param name=""url"" value=") Then Response.write "StrLine(PARAM):"&strLine&"<BR>"
'mObjRegExp.pattern="<param.+?value=""([^""]+)"""
Set mObjMatches = mObjRegExp.Execute(strLine)
If mObjMatches.Count = 0 Then Else DescriptionParam = mObjMatches.item(0).Value If Len(DescriptionParam) > 5 Then DescriptionParam = Mid(DescriptionParam,
InStr(1,DescriptionParam, "value=""", vbTextCompare) + 7) DescriptionParam = Mid(DescriptionParam, 1, InStr(1,
DescriptionParam, """", vbTextCompare)-1) ParamFlag = 1 Else ParamFlag = 0 End If End If Else 'Checking for Param applet links End If 'Checking for Param applet links Set mObjMatch = Nothing Set mObjMatches = Nothing Set mObjRegExp = Nothing Response.write "<BR>test : " & DescriptionParam & "<BR>" %>
Your outer IF statement checks for the following:
InStr(lcase(strLine),"<param name=""url"" value=")
This check fails for the first strLine listed.
HTH
-Chris Hohmann
Chri
how silly iam...thanks! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: MJ |
last post by:
I'm having problems coming up with a regular expression that works for what
I want. I need to extract a few numbers from from html. Here's a snippet:
<tr><td align="right">Consolidated Metro...
|
by: Jack Smith |
last post by:
I posted this question earlier, but I got no responses. Can anyone
help me out here...any hints or even how to start? Thanks in advance.
Let doubleswap(x) be the string formed by replacing each...
|
by: Kenneth McDonald |
last post by:
I'm working on the 0.8 release of my 'rex' module, and would appreciate
feedback, suggestions, and criticism as I work towards finalizing the
API and feature sets. rex is a module intended to make...
|
by: Stitch Jones |
last post by:
I'm trying to get part of my perl script using a regex to get rid of
an entire field between two ,'s I'm doing this to get a .csv formated
alot nicer. here is an example of my issue
user...
|
by: Buddy |
last post by:
Can someone please show me how to create a regular expression to do the
following
My text is set to
MyColumn{1, 100} Test
I want a regular expression that sets the text to the following...
| |
by: Neri |
last post by:
Some document processing program I write has to deal with documents
that have headers and footers that are unnecessary for the main
processing part. Therefore, I'm using a regular expression to go...
|
by: Chris |
last post by:
Hi everyone,
I'm trying to parse through the contents of some text files with regular
expressions, but am new to regular expressions and how to use them in
VB.net.
I'm pretty sure that the...
|
by: Mr.Steskal |
last post by:
Posted: Wed Jul 11, 2007 7:01 am Post subject: Regular Expression
Help
--------------------------------------------------------------------------------
I need help writing a regular...
|
by: =?Utf-8?B?TWF0dA==?= |
last post by:
I have the following words, and I want to extract the first part and the
trailing numbers.
OP001 =ABC, 001
ST02 =CD, 02
00A =00A, null
I have the following regular express:...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |