Regular expression difference in NN.

G

Guru

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>

I wrote regular expression
1.var extractTR = /<tr(.|\n|\r)*<\/tr>/mgi;
2.table_tr_arr = withReportPage.match(extractTR); //withReportPage is
the string.

When i execute in IE, everything is working, but when i open it in
NN 7, it is crashing when that line is executed !. Seems greedy search
is not supported in NN7 ??

Help !!!!

-Prasanna.
 
M

Martin Honnen

Guru said:
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>

I wrote regular expression
1.var extractTR = /<tr(.|\n|\r)*<\/tr>/mgi;
2.table_tr_arr = withReportPage.match(extractTR); //withReportPage is
the string.

When i execute in IE, everything is working, but when i open it in
NN 7, it is crashing when that line is executed !. Seems greedy search
is not supported in NN7 ??

Sure it is, it is the default matching anyway so there is nothing in the
ECMAScript regular expression pattern language to indicate you want
greedy matching.
Of course scripting engines can have bug, browsers can have bugs but I
am not able to reproduce any problem here, as you haven't provided a
full test case I have made one using the snippets you have provided
above, it is here:
http://home.arcor.de/martin.honnen/javascript/200407/test20040720.html
It doesn't crash Netscape 7.1 (Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)) here on Windows XP and
shows the same result as Opera 7 and IE 6.

If you have problems make a test case showing the problem and post a URL
and tell us which browser version you have tested with. Or if the above
test case crashes your Netscape 7 then please post the exact version.
 
G

Guru

I am using NN 7.2
It is really surprise that it is working in your test case.
Probably, my code is wrong. I will check again.
I am using more tags inside those <tr> tags.


thanks,
G.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top