I have a reg exp pattern as below works fine for the string : <param name="url" value="contents/cf_intro.htm" valuetype="ref" >
mObjRegExp.patt ern="<param.+?v alue=""([^""]+)""
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 1436
"Raj.SB" <sgmuser#rediff mail.com> wrote in message
news:E4******** *************** ***********@mic rosoft.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.patt ern="<param.+?v alue=""([^""]+)"""
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=""content s/cf_intro.htm""> " 'will return nothing
strLine = "<param name=""url"" value=""content s/cf_intro.htm"" valuetype=""ref "">" 'will return 'contents/cf_intro.htm'
Set mObjRegExp = New RegExp
mObjRegExp.Igno reCase = True
mObjRegExp.Mult iLine = True
mObjRegExp.Glob al = True
If InStr(lcase(str Line),"<param name=""url"" value=") Then
Response.write "StrLine(PARAM) :"&strLine&"<BR >"
'mObjRegExp.pat tern="<param.+? value=""([^""]+)"""
Set mObjMatches = mObjRegExp.Exec ute(strLine)
If mObjMatches.Cou nt = 0 Then
Else
DescriptionPara m = mObjMatches.ite m(0).Value
If Len(Description Param) > 5 Then
DescriptionPara m = Mid(Description Param, InStr(1,Descrip tionParam, "value=""", vbTextCompare) + 7)
DescriptionPara m = Mid(Description Param, 1, InStr(1, DescriptionPara m, """", 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 : " & DescriptionPara m & "<BR>"
%>
"Raj.SB" <an*******@disc ussions.microso ft.com> wrote in message
news:0B******** *************** ***********@mic rosoft.com... <% strLine = "<param name=""url"" valuetype=""ref ""
value=""content s/cf_intro.htm""> " 'will return nothing strLine = "<param name=""url"" value=""content s/cf_intro.htm""
valuetype=""ref "">" 'will return 'contents/cf_intro.htm' Set mObjRegExp = New RegExp mObjRegExp.Igno reCase = True mObjRegExp.Mult iLine = True mObjRegExp.Glob al = True
If InStr(lcase(str Line),"<param name=""url"" value=") Then Response.write "StrLine(PARAM) :"&strLine&"<BR >"
'mObjRegExp.pat tern="<param.+? value=""([^""]+)"""
Set mObjMatches = mObjRegExp.Exec ute(strLine)
If mObjMatches.Cou nt = 0 Then Else DescriptionPara m = mObjMatches.ite m(0).Value If Len(Description Param) > 5 Then DescriptionPara m = Mid(Description Param,
InStr(1,Descrip tionParam, "value=""", vbTextCompare) + 7) DescriptionPara m = Mid(Description Param, 1, InStr(1,
DescriptionPara m, """", 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 : " & DescriptionPara m & "<BR>" %>
Your outer IF statement checks for the following:
InStr(lcase(str Line),"<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 Area (CMSA)</td><td
align="left"><strong> SEATTLE-TACOMA-BREMERTON, WA
( 7602 )</td></tr>
<tr><td align="right">Primary Metro Area (PMSA)</td><td
align="left"><strong>SEATTLE-BELLEVUE-EVERETT, WA
( 7600 )</td></tr>
|
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 a in x by the
substring bb and each b by the substring aa. For example,
doubleswap(abcab)=bbaacbbaa. Furthermore, let doubleswap(L) be the
language formed of strings doubleswap(x) for x an element of L. Prove
that if L is regular, then so is...
|
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 regular expressions
easier to create and use (and in my experience as a regular expression
user, it makes them MUCH easier to create and use.)
I'm still working on formal documentation, and in any case, such
documentation isn't necessarily the...
|
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 ,jibberjibber 1234456hithere(hkl)- special char jibber, 4567
I need the keep the user part and the end 4567 part but all the stuff
between the two ,'s has gotta go. Someone Please help.
Thank you.
|
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
testMyColumn{1, 100}Test
Basically I want the regular expression to add the word test infront of the
| |
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 over
each document, find out if it contains a header and/or a footer and
extract only the main content part.
The headers and the footers have no specific format and I have to
detect and remove them using a list of strings that may appear as...
|
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 regular expressions are correct as I got them from
regexlib.com and tested them in the Regulator and Expresso.
The problem is I tested this function with a file that contains a string
|
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 expression that only returns part of a
string.
For Example I have a multi-line text fragment like below:
|
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:
(?<first>.*?)(?<second>\d+)
This one works well for the given first two examples but not the third one.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |