473,394 Members | 1,201 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,394 software developers and data experts.

parsing difference between Netscape and IE.


I have the three following scripts.

var pat_piece=/(\w{2})-(\w{2,3})/;
item=="kpgn9">[Setup "WN-a10 WR-a11 WP-c5 SR-d1 SN-e1 SB-f1"]
var piece=item.split(pat_piece);

Netscape is able to split it correctly while IE isn't. What should
pat_piece look like if I only want item to be splitted any word
like WN-a10 to two?

Thanks.
Jul 23 '05 #1
5 1432
Better but still clumpsy wrote:
I have the three following scripts.

var pat_piece=/(\w{2})-(\w{2,3})/;
item=="kpgn9">[Setup "WN-a10 WR-a11 WP-c5 SR-d1 SN-e1 SB-f1"]
var piece=item.split(pat_piece);

Netscape is able to split it correctly while IE isn't. What should
What do you mean by "split it correctly"? It doesn't work at
all in any browser I tried it in.
pat_piece look like if I only want item to be splitted any word
like WN-a10 to two?


If you want to split only on the '-', then split on it:

var item = "WN-a10 WR-a11 WP-c5 SR-d1 SN-e1 SB-f1";
var piece = item.split('-');

'piece' will be an array where:

piece[0] = "WN"
piece[1] = "a10 WR"
piece[2] = "a11 WP"
...
piece[6] = "f1"

If you want to split on the spaces also, either replace one or
more spaces with '-' then split on the '-', or split on either
'-' or '\s+':

var piece = item.split(/-|\s+/)

now 'piece' will be an array where:

piece[0] = "WN"
piece[1] = "a10"
piece[2] = "WR"
...
piece[11] = "f1"

the pattern \s+ will match one or more white space characters,
which is any of \f \n \r \t \v \u00A0 \u2028 \u2029

--
Rob
Jul 23 '05 #2
rh
Better but still clumpsy wrote:
I have the three following scripts.

var pat_piece=/(\w{2})-(\w{2,3})/;
item=="kpgn9">[Setup "WN-a10 WR-a11 WP-c5 SR-d1 SN-e1 SB-f1"]
var piece=item.split(pat_piece);

Netscape is able to split it correctly while IE isn't. What should
pat_piece look like if I only want item to be splitted any word
like WN-a10 to two?


There are a number of problems here.

For starters, the sample code you have given is incorrect. Since
"split" works on strings, it would seem that you meant item to be
assigned a string, and perhaps that was supposed to read:

item = '"kpgn9">[Setup "WN-a10 WR-a11 WP-c5 SR-d1 SN-e1 SB-f1"]';

Then on to the difficulties with IE. Rather unfortunately "window.item"
seems to be some sort of pre-defined property in IE, and it cannot be
overridden unless it is prefixed with "var " (go figure :~/). So

var item = '"kpgn9">[Setup "WN-a10 WR-a11 WP-c5 SR-d1 SN-e1 SB-f1"]';

allows the assignment (but it might be prudent to choose a different
identifier).

Next, IE doesn't split the string in accordance with the ECMA 263/3
standard, as it appears not to do the splicing of captured values back
into the string segments as it performs the split.

If the given pattern is required to effect the split, your best
alternative is likely to pre-condition the string prior to splitting,
e.g.,

var piece = item.replace(pat_piece, "$1#$2").split("#");

../rh

Jul 23 '05 #3
rh

rh wrote:

var piece = item.replace(pat_piece, "$1#$2").split("#");


And of course pat_piece will also need a "g" modifier added.

../rh

Jul 23 '05 #4
"rh" <co********@yahoo.ca> writes:

Yes, I made a mistake(typo). Actually, item was fetched from a combo
box like this.
item=kpgn_list.options[i].text; and item was declared at the
beginning of the function.

After it split, I call three function to get the piece, x and y
coordinate for displaying the table.

Thanks.
Better but still clumpsy wrote:
I have the three following scripts.

var pat_piece=/(\w{2})-(\w{2,3})/;
item=="kpgn9">[Setup "WN-a10 WR-a11 WP-c5 SR-d1 SN-e1 SB-f1"]
var piece=item.split(pat_piece);

Netscape is able to split it correctly while IE isn't. What should
pat_piece look like if I only want item to be splitted any word
like WN-a10 to two?


There are a number of problems here.

For starters, the sample code you have given is incorrect. Since
"split" works on strings, it would seem that you meant item to be
assigned a string, and perhaps that was supposed to read:

item = '"kpgn9">[Setup "WN-a10 WR-a11 WP-c5 SR-d1 SN-e1 SB-f1"]';

Then on to the difficulties with IE. Rather unfortunately "window.item"
seems to be some sort of pre-defined property in IE, and it cannot be
overridden unless it is prefixed with "var " (go figure :~/). So

var item = '"kpgn9">[Setup "WN-a10 WR-a11 WP-c5 SR-d1 SN-e1 SB-f1"]';

allows the assignment (but it might be prudent to choose a different
identifier).

Next, IE doesn't split the string in accordance with the ECMA 263/3
standard, as it appears not to do the splicing of captured values back
into the string segments as it performs the split.

If the given pattern is required to effect the split, your best
alternative is likely to pre-condition the string prior to splitting,
e.g.,

var piece = item.replace(pat_piece, "$1#$2").split("#");

../rh

Jul 23 '05 #5
Hi RobG,

Well, I made a mistake(typo). Actually, item was fetched from
a combo box like this.

item=kpgn_list.options[i].text;

Of coourse, it work on Netscape/Modzilla. What I mean by split
correctly, the data in the piece array have :
piece[.] = "WN"
piece[.+1] = "a10"
piece[.+2] = "WR"
piece[.+3] = "a11"
and IE gave me only
Setup and the rest of array blank.

Anyway, I am using just /-/ and all browsers are splitting the same
and I had modified the function to accomodate this splitting array.
The program is working on all three browsers now.
My only task left is to size the combo box so that it will look
the same on any browser. Right now, it uses default size and IE
gave me only three lines of item while Netscape gave me just
about the right size that is fitted in its parent frame.
If you want too, you can take a look at it.

http://71.96.69.35

PS. Since, Verizon is no longer give me a fix IP address, this
URL might not be valid if my network/computer is rebooted.

Thanks for all your help.
RobG <rg***@iinet.net.auau> writes:
Better but still clumpsy wrote:
I have the three following scripts.
var pat_piece=/(\w{2})-(\w{2,3})/;
item=="kpgn9">[Setup "WN-a10 WR-a11 WP-c5 SR-d1 SN-e1 SB-f1"]
var piece=item.split(pat_piece);
Netscape is able to split it correctly while IE isn't. What should


What do you mean by "split it correctly"? It doesn't work at
all in any browser I tried it in.
pat_piece look like if I only want item to be splitted any word
like WN-a10 to two?


If you want to split only on the '-', then split on it:

var item = "WN-a10 WR-a11 WP-c5 SR-d1 SN-e1 SB-f1";
var piece = item.split('-');

'piece' will be an array where:

piece[0] = "WN"
piece[1] = "a10 WR"
piece[2] = "a11 WP"
...
piece[6] = "f1"

If you want to split on the spaces also, either replace one or
more spaces with '-' then split on the '-', or split on either
'-' or '\s+':

var piece = item.split(/-|\s+/)

now 'piece' will be an array where:

piece[0] = "WN"
piece[1] = "a10"
piece[2] = "WR"
...
piece[11] = "f1"

the pattern \s+ will match one or more white space characters,
which is any of \f \n \r \t \v \u00A0 \u2028 \u2029

--
Rob

Jul 23 '05 #6

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

Similar topics

2
by: John Max Skaller | last post by:
please reply to skaller@ozemail.com.au (I don't read this newsgroup, and the reply-to address is fake) For some time now -- over 5 years -- I have been using the interscript literate programming...
2
by: Michele Simionato | last post by:
I use Mozilla or Netscape, so my emails are stored in the nsmail directory or the Mozilla's equivalent. What's the simplest way to look at them and extract the mails with a given subject? In...
1
by: cmika | last post by:
Problem: Mozilla mailbox is way to big (800MBs). Solution: Split it up. #!/usr/bin/perl ############ # Splits Mozilla style Inboxes into smaller ones (max size = maxMailboxSize) # use:...
16
by: Ben | last post by:
I have a page (www.eastex.net/ben/NewETN/index3.asp) that displays OK in IE, but not in Netscape. I used a combination of padding-top and height attributes to get a total height on four cells. ...
4
by: Guru | last post by:
I am using a string which has <tr> tags inside it. I want to do a greedy search on it. For eg.. if that string contains, <nothing><tr>bla</tr><tr>blablabla</tr><tr>hi</tr></nothing> I want to...
4
by: JJ_377 | last post by:
Why won't Netscape do the intended in the following? IE is able to render this page as intended. It is is a "self-posting" ASP form with a JavaScript validation function: if the form fails the...
3
by: Sanjay Arora | last post by:
We are looking to select the language & toolset more suitable for a project that requires getting data from several web-sites in real- time....html parsing/scraping. It would require full emulation...
3
by: toton | last post by:
Hi, I have some ascii files, which are having some formatted text. I want to read some section only from the total file. For that what I am doing is indexing the sections (denoted by .START in...
0
by: =?Utf-8?B?VWxmIFRob3JzZW4=?= | last post by:
I use Visual Studio 2005 for a C-project using an external compiler, and came up with the idea that error parsing would be neat, i.e. enabling the functionality available for a "normal" build...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.