473,799 Members | 3,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with regular expressions, IE vs. firefox

cjl
Hey all:

Given the following code:

var ct_series = [21,23]
var cr_series = [12]

function preload()
{
for ( parm in window )
{
if ( parm.match('_se ries') )
{
alert("Found one!");
}
}
}

In firefox and mozilla I get the alerts, in IE I do not.

If I try:

function preload()
{
for (parm in window)
{
alert("Found one:" + parm);
}
}

I see the alerts in IE, so I know that IE can iterate through the
window object. But none of the alert boxes show cr_series or
ct_series. In fact, this same code in Firefox results in roughly three
times as many alerts, listing objects that were not listed when run
through IE.

Help?

-CJL

Jul 23 '05 #1
3 1653
cjl
Hey all:

If you've read this far, you realize that my subject line is wrong.

This is not a problem with regular expressions, but a problem with my
understanding of the window object.

I though global variables were attributes of the window object that I
could iterate through?

Maybe I should repost (double post) with a correct subject line.

-CJL

Jul 23 '05 #2
Lee
cjl said:

Hey all:

Given the following code:

var ct_series = [21,23]
var cr_series = [12]

function preload()
{
for ( parm in window )
{
if ( parm.match('_se ries') )
{
alert("Found one!");
}
}
}

In firefox and mozilla I get the alerts, in IE I do not. I see the alerts in IE, so I know that IE can iterate through the
window object. But none of the alert boxes show cr_series or
ct_series. In fact, this same code in Firefox results in roughly three
times as many alerts, listing objects that were not listed when run
through IE.


The for..in loop doesn't show all of the attributes of the object.
Different browsers can, and apparently do, choose to make different
attributes visible to it.

You might be better off using a custom Object. All attributes that
you add to a custom object are visible to for..in:

var global=new Object();
global.ct_serie s = [21,23]
global.cr_serie s = [12]

function preload()
{
msg="<html><bod y>";
for ( parm in global )

Jul 23 '05 #3
cjl
Lee:

Thank you, that makes sense, I wasn't sure. So I guess IE doesn't make
global variables visible to it.

And I guess by creating a custom object, my for loop iterates through
considerably fewer items and not all of the attributes of the window
object, which is nice.

-CJL

Jul 23 '05 #4

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

Similar topics

1
4187
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...
2
5100
by: Sehboo | last post by:
Hi, I have several regular expressions that I need to run against documents. Is it possible to combine several expressions in one expression in Regex object. So that it is faster, or will I have to use all the expressions seperately? Here are my regular expressions that check for valid email address and link Dim Expression As String =
5
1660
by: Greg Vereschagin | last post by:
I'm trying to figure out a regular expression that will match the innermost tag and the contents in between. Specifically, the string that I am attempting to match looks as follows: ....<table>...<table>...>Final<...</table>...</table>... I want to match: <table>...>Final<...</table> from this example. The string could also, of course, look like the following:
5
1595
by: Kijak | last post by:
Hi, Im just starting working with REGEX and got a few problems. Could you tell me how to test if two strings can be found in another. ei: String to test: "This is a great car you got" Look for: "great" AND "car" and what about upper case
4
5187
by: Együd Csaba | last post by:
Hi All, I'd like to "compress" the following two filter expressions into one - assuming that it makes sense regarding query execution performance. .... where (adate LIKE "2004.01.10 __:30" or adate LIKE "2004.01.10 __:15") .... into something like this: .... where adate LIKE "2004.01.10 __:(30/15)" ...
12
5580
by: Vadim Guchenko | last post by:
Hello. I'm using the following code: <html> <head> <style type="text/css"> pre {display: inline;} </style> </head>
4
6057
by: =?Utf-8?B?Y3VyaW91cw==?= | last post by:
I am using a RegularExpressionValidator to validate a TextBox. I use "^?+(\.*)?$" to check for a real number. The control works fine as long as the user enters something in the TextBox; it does not work if the user leaves the TextBox blank. Is there a bug in the implementation of the RegularExpressionValidator? The above regluar expression should also catch no entry by the user. I have added a RequiredFieldValidator to solve the...
1
4388
by: Allan Ebdrup | last post by:
I have a dynamic list of regular expressions, the expressions don't change very often but they can change. And I have a single string that I want to match the regular expressions against and find the first regular expression that matches the string. I've gor the regular expressions ordered so that the highest priority is first (if two or more regular expressions match the string I want the first one returned) The code that does this has...
13
7495
by: Wiseman | last post by:
I'm kind of disappointed with the re regular expressions module. In particular, the lack of support for recursion ( (?R) or (?n) ) is a major drawback to me. There are so many great things that can be accomplished with regular expressions this way, such as validating a mathematical expression or parsing a language with nested parens, quoting or expressions. Another feature I'm missing is once-only subpatterns and possessive quantifiers...
0
9546
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,...
0
10268
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10247
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10031
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 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...
0
9079
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, 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...
0
6809
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();...
0
5467
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.