473,804 Members | 3,209 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.spli t(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 1452
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.spli t(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.spli t(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.ite m"
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(pa t_piece, "$1#$2").split( "#");

../rh

Jul 23 '05 #3
rh

rh wrote:

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


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

../rh

Jul 23 '05 #4
"rh" <co********@yah oo.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.spli t(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.ite m"
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(pa t_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.ne t.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.spli t(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
1828
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 and document generation tool http://interscript.sourceforge.net for all my programming tasks, both commercial and personal.
2
1531
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 principle I could use a regular expression, but I bet there are better solutions already available. Second question: are Mozilla and Netscape compatible, i.e. are the emails stored with the same format and can I use the same extraction method on...
1
2772
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: ./splitMozilla <mailbox name> # output: mailbox0 ... ############
16
2419
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. Netscape seems to not respect the padding-top, and only goes by the height, resulting in the cells being too short. What options do I have in CSS? I would like to be able to specify the height by using a definite attribute (I thought height was...
4
1272
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 extract the things inside <tr>..</tr> tags. Like, <tr>bla</tr><tr>blablabla</tr><tr>hi</tr>
4
1695
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 JavaScript validation function, then the form should not post and an alert should be issued as indicated below. The *first* alert in the Validate function works in NS, but the rest of the code does not and therefore I wonder about the way I am...
3
2885
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 of the browser, including handling cookies, automated logins & following multiple web-link paths. Multiple threading would be a plus but not requirement. Some solutions were suggested: Perl:
3
4390
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 the file) with the location. And for a particular section I parse only that section. The file is something like, .... DATAS
0
1994
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 where you can double click a compile error/warning message and be guided to the file/line in question. Using sed to filter output from the compiler i managed to make the error output look like the ones generated from the regular compiler, and...
0
9708
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, 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...
0
10085
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
9161
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...
1
7623
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 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...
0
6857
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
5527
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...
0
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
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
3
2998
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 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...

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.