473,406 Members | 2,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Non Greedy Regular Expression in Scripting Engine 5.1

Hi. I really need help with a regular expression in ASP. I need a regex
pattern that will grab a select or textarea tag in an HTML file. If I run
the pattern I should get

<select name="whatever">
<option value="a" selected>A</option>
<option value="b">B</option>
<option value="c">C</option>
</select>

Or

<textarea name="whatever">Here is some text area text</textarea>

I know the following pattern works:

<(select|textarea).*(.|\n)*?</(select|textarea)>

But the problem is my web hosting company is using ASP scripting engine 5.1
which does not support the non greedy delimiter (?). I doubt they are going
to upgrade to 5.5 anytime soon. I'll appreciate it if anyone can give me a
pattern that does the same job but does not use the ? delimiter. Is there a
way I can tweak the pattern above so that it works in ASP scripting engine
5.1? Thanks in advance.
Jul 19 '05 #1
2 1392
"Wole" <an********@annonymous.com> wrote in message
news:ef***************************@msgid.meganewss ervers.com...
But the problem is my web hosting company is using ASP scripting engine 5.1 which does not support the non greedy delimiter (?). I doubt they are going to upgrade to 5.5 anytime soon.


I don't have an answer to your question, but have tried asking your hosting
company if they would upgrade? I may be wrong, but I think all that's
required is for them to upgrade to IE 5.5 (or better yet, 6) on the server.
I had a similar problem a few months back, and the host didn't mind
upgrading. It fixed my problem... you might try asking. :)

Regards,
Peter Foti
Jul 19 '05 #2
Wole wrote on 25 feb 2004 in microsoft.public.inetserver.asp.general:
Hi. I really need help with a regular expression in ASP. I need a
regex pattern that will grab a select or textarea tag in an HTML file.
If I run the pattern I should get

<select name="whatever">
<option value="a" selected>A</option>
<option value="b">B</option>
<option value="c">C</option>
</select>

Or

<textarea name="whatever">Here is some text area text</textarea>

I know the following pattern works:

<(select|textarea).*(.|\n)*?</(select|textarea)>

But the problem is my web hosting company is using ASP scripting
engine 5.1 which does not support the non greedy delimiter (?). I
doubt they are going to upgrade to 5.5 anytime soon. I'll appreciate
it if anyone can give me a pattern that does the same job but does not
use the ? delimiter. Is there a way I can tweak the pattern above so
that it works in ASP scripting engine 5.1? Thanks in advance.


my unintested idea would be:

1 test if the file iss without the "~" character

2 replace all "</select>" with "~"

3 use string <select>[^~]*~

4 replace the "~" in the resulting string with "</select>"

Use a seperate and similar code for <textarea>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #3

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

Similar topics

12
by: lothar | last post by:
re: 4.2.1 Regular Expression Syntax http://docs.python.org/lib/re-syntax.html *?, +?, ?? Adding "?" after the qualifier makes it perform the match in non-greedy or minimal fashion; as few...
3
by: Jane Doe | last post by:
Hello, I need to browse a list of hyperlinks, each followed by an author, and remove the links only for certain authors. 1. I searched the archives on Google, but didn't find how to tell the...
2
by: ch2x | last post by:
Now I have a regular expression: string pattern = @"*?(?<content>\<div id='news'\>\<div*?\<\/div\>*?\<\/div\>)*"; I want to use this pattern to match a html file's content,and replace the file's...
8
by: John Hazen | last post by:
I want to match one or two instances of a pattern in a string. According to the docs for the 're' module ( http://python.org/doc/current/lib/re-syntax.html ) the '?' qualifier is greedy by...
14
by: olekristianvillabo | last post by:
I have a regular expression that is approximately 100k bytes. (It is basically a list of all known norwegian postal numbers and the corresponding place with | in between. I know this is not the...
9
by: Pete Davis | last post by:
I'm using regular expressions to extract some data and some links from some web pages. I download the page and then I want to get a list of certain links. For building regular expressions, I use...
5
by: Cylix | last post by:
I am going to write a function that the search engine done. in search engine, we may using double quotation to specify a pharse like "I love you", How can I using regular expression to sperate...
6
by: EXI-Andrews, Jack | last post by:
the '*' and '+' don't seem to be greedy.. they will consume less in order to match a string: ('aa', 'ab') this is the sort of behaviour i'd expect from '(a+?)(ab)' a+ should greedily...
6
by: rorymo | last post by:
I have a regular expression that allows only certain characters to be valid in an xml doc as follows: <xs:pattern value="^*" /> What I want to do is also allow any unicode character that is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...
0
isladogs
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...

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.