473,397 Members | 2,077 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,397 software developers and data experts.

regx, global efficiencies?

If we toss this in a global area, is it compiled just once one the js
file is included in the new page?

var re = /[^\x09-\x0D\x20-\x7E]/o

Thank you.

Jun 27 '08 #1
4 1180
On Jun 9, 5:43 pm, oldyork90 <oldyor...@yahoo.comwrote:
If we toss this in a global area, is it compiled just once one the js
file is included in the new page?

var re = /[^\x09-\x0D\x20-\x7E]/o

Thank you.
whoops.. this too
var regex = new RegExp(re);
Jun 27 '08 #2
On Jun 10, 8:45 am, oldyork90 <oldyor...@yahoo.comwrote:
On Jun 9, 5:43 pm, oldyork90 <oldyor...@yahoo.comwrote:
If we toss this in a global area, is it compiled just once one the js
file is included in the new page?
var re = /[^\x09-\x0D\x20-\x7E]/o
Thank you.

whoops.. this too
var regex = new RegExp(re);
Yes.

What benefit is there is to calling RegExp as a constructor with re as
the argument whey you've already initalised re as a regular
expression. As far as I know, it just creates another instance of re
(i.e. re is effectively === regexp).

Oh, there is no 'o' flag, ECMAScript has only g, i and m flags.
--
Rob
--
Rob
Jun 27 '08 #3
oldyork90 wrote:
If we toss this in a global area, is it compiled just once one the js
file is included in the new page?

var re = /[^\x09-\x0D\x20-\x7E]/o
It does not compile because `o' is an unsupported flag. Unless, of course,
you are using an implementation that extends ECMAScript to support it. For
everything else (including your followup), please read the ECMAScript
Specification, Edition 3 Final.
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Jun 27 '08 #4
On Jun 9, 7:47 pm, RobG <rg...@iinet.net.auwrote:
On Jun 10, 8:45 am, oldyork90 <oldyor...@yahoo.comwrote:
On Jun 9, 5:43 pm, oldyork90 <oldyor...@yahoo.comwrote:
If we toss this in a global area, is it compiled just once one the js
file is included in the new page?
var re = /[^\x09-\x0D\x20-\x7E]/o
Thank you.
whoops.. this too
var regex = new RegExp(re);

Yes.

What benefit is there is to calling RegExp as a constructor with re as
the argument whey you've already initalised re as a regular
expression. As far as I know, it just creates another instance of re
(i.e. re is effectively === regexp).

Oh, there is no 'o' flag, ECMAScript has only g, i and m flags.

--
Rob

--
Rob
Thanks Rob. Ok then, 'var re = /[^\x09-\x0D\x20-\x7E]/' is all I
need. I wasn't sure if that actually
compiled the expression on not. I thought perhaps all it did was
assign a string. FYI, that 'o' was a perl
artifact I guess. Thanks again.
Jun 27 '08 #5

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

Similar topics

8
by: David Hitillambeau | last post by:
Hi guys, As I am new to Python, i was wondering how to declare and use global variables. Suppose i have the following structure in the same module (same file): def foo: <instructions>...
10
by: David P. Donahue | last post by:
When I wrote websites in VB .NET, I would often put functions in Global for all the pages to call. Now, in C#, doing so results in "references to non-static objects" and whatnot. I realize what...
3
by: Jerry Morton | last post by:
Hi, My ASP.NET application will be installed on multiple web sites on one server. This means that the application DLL will be loaded once for each installation - which seems inefficient. If I...
1
by: Glenn Wilson | last post by:
Can anyone help me with a regx to match the values 1 to 6. No these could come in several formats and we only want matches where there is a single number with no other numbers next to it in the...
1
by: Jake Barnes | last post by:
This was working for me, and now it isn't, and I can't remember what i changed - the idea was to imitate the PHP command nl2br, which takes newlines and turns them into newlines plus BR tags. Does...
8
by: Rob T | last post by:
When I was using VS2003, I was able to compile my asp.net project locally on my machine and copy it to the production server and it would run just fine. I've now converted to VS2005. The project...
1
weaknessforcats
by: weaknessforcats | last post by:
C++: The Case Against Global Variables Summary This article explores the negative ramifications of using global variables. The use of global variables is such a problem that C++ architects have...
3
by: Cain | last post by:
A very simple regular expression test: var regx = /^\d+$/g; alert(regx.test("11") + ": " + regx.test("11")); And the output is "true: false". If I change to regx = new RegExp("^\\d+$",...
1
by: jain236 | last post by:
Hi i am trying to write regx for the time format HH:MM:SS in the below way /\d:\d0:\d/ but i could not get the desired output, can some one throw some light why and where it is going wrong?...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.