473,503 Members | 9,057 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Regular Express Help Needed Please!

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.
Jul 19 '05 #1
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.
Jul 19 '05 #2
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?
Jul 19 '05 #3
<%
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>"
%>
Jul 19 '05 #4
"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
Jul 19 '05 #5
Chri
how silly iam...thanks!
Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1717
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...
2
1891
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...
1
4155
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...
4
8268
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...
4
5098
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...
4
3203
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...
3
2530
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...
3
1815
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...
5
2001
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:...
0
7193
marktang
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,...
0
7067
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...
0
7264
Oralloy
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,...
0
5562
agi2029
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,...
0
4666
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...
0
3160
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...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
371
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.