473,606 Members | 2,756 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What's the future of RegExp object properties?

Hallo,

I yesterday was browsing the book, JavaScript The Definitive Guide
(4th ed), which is, unquestionably, the best reference book for JS. To
my surprise, I didn't find any documentation about the static
properties of global RegExp object, ie, RegExp.lastMatc h,
RegExp.leftCont ext, RegExp.rightCon text, and all those RegExp.$x
properties. I lloked up the ECMA-262 PDF and to my surprise realized
that they are not included into the standard.
I don't wuite know the reasons, why it is done so, I may guess that
it's because of their awkward namespace. Still, that functionality is
specified in core JavaScript 1.2 (at least JavaScript the Definitive
Guide 3rd ed states so), and I doubt that such features would be taken
off from the JavaScript standard in future. It's somewhat bitter that
the 4th edition focuses on ECMA standard rather than JavaScript.
But now, I am quite concerned about the future of those RegExp object
properties. I there some info about their possible inclusion in the
ECMA standard? Is it now 'deprecated' to use them, and coders should
use workarounds?

Thanks,

-- Pavils
Jul 20 '05 #1
1 1737


Pavils Jurjans wrote:
I yesterday was browsing the book, JavaScript The Definitive Guide
(4th ed), which is, unquestionably, the best reference book for JS. To
my surprise, I didn't find any documentation about the static
properties of global RegExp object, ie, RegExp.lastMatc h,
RegExp.leftCont ext, RegExp.rightCon text, and all those RegExp.$x
properties. I lloked up the ECMA-262 PDF and to my surprise realized
that they are not included into the standard.
I don't wuite know the reasons, why it is done so, I may guess that
it's because of their awkward namespace. Still, that functionality is
specified in core JavaScript 1.2 (at least JavaScript the Definitive
Guide 3rd ed states so), and I doubt that such features would be taken
off from the JavaScript standard in future. It's somewhat bitter that
the 4th edition focuses on ECMA standard rather than JavaScript.
The standard for JavaScript is the ECMAScript standard which is
currently in edition 3. This is the first edition to introduce RegExp at
all, and as you have found out the static properties you list above are
not defined in that standard. Thus there is no need to "take the
features off from the Javascript standard in the future", they are not
part of the standard.
But now, I am quite concerned about the future of those RegExp object
properties. I there some info about their possible inclusion in the
ECMA standard? Is it now 'deprecated' to use them, and coders should
use workarounds?


As RegExp implementations with those properties existed when ECMAScript
edition 3 was written I am sure these properties were intentionally not
made part of the standard and therefore I guess there is no intention to
add them in later editions.
As for the reasons I guess it is akward that instance methods have the
side effect of changing static properties. Of course it would have been
nice to have things like rightContext as a property of the result of
exec but somehow it is not part of the standard.
As for using those properties if you want to write cross browser
JavaScript don't do it, for instance Opera 7 (tested with 7.20) doesn';t
implement rightContext at all.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

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

Similar topics

0
6800
by: Ravi Tallury | last post by:
Hi We are having issues with our application, certain portions of it stop responding while the rest of the application is fine. I am attaching the Java Core dump. If someone can let me know what the issue is. Thanks Ravi
2
4051
by: timmy_dale12 | last post by:
Im implementing a calendar and cant figure out what this method does or how it works // datetime parsing and formatting routimes. modify them if you wish other datetime format function str2dt (str_datetime) { var re_date = /^(\d+)\-(\d+)\-(\d+)\s+(\d+)\:(\d+)\:(\d+)$/; if (!re_date.exec(str_datetime)) return alert("Invalid Datetime format: "+ str_datetime); return (new Date (RegExp.$3, RegExp.$2-1, RegExp.$1, RegExp.$4,
10
7677
by: Andrew DeFaria | last post by:
I was reading my O'Reilly JavaScript The Definitive Guide when I came across RegExp and thought I could tighten up my JavaScript code that checks for a valid email address. Why does the following not appear to work: var email_address = "Joe@Schmoe"; var email_regex = new RegExp ("^(\\w+)(\@)(\\w+)(\.)(\\w+)$"); var result = email_regex.exec (email_address); alert (" result = \"" + result + "\"\n" + " result = \"" + result + "\"\n" + "...
20
3524
by: RobG | last post by:
I'm messing with getPropertyValue (Mozilla et al) and currentStyle (IE) and have a general function (slightly modified from one originally posted by Steve van Dongen) for getting style properties: function GetCurrentStyle( el, prop ) { if ( window.getComputedStyle ) { // Mozilla et al return window.getComputedStyle(el, '').getPropertyValue(prop) ); } // IE5+ else if ( el.currentStyle ) {
0
1813
by: Chris Croughton | last post by:
I'm trying to use the EXSLT regexp package from http://www.exslt.org/regexp/functions/match/index.html (specifically the match function) with the libxml xltproc (which supports EXSLT), but whatever I do gets errors. The examples use namespace regExp, but the supplied files use regexp, I've got it so that it at least doesn't complain about namespaces but it then complains that it can't find the match function. My stylesheet is:
8
11434
by: kevin | last post by:
I have a form and in the form I have a sub that uses a class I instantiate using visual basic code: Public oCP As New Rs232 'instantiate the comm port I need to share this sub with another form so to declare the sub I use visual basic code: Public Shared Function IsPortAvailable(ByVal ComPort As Integer) As Boolean
2
4742
by: brad | last post by:
Hello all, I'm new to javascript--not too new to a few other programming languages--and I need your help deciphering the Regexp in the following string. Regular expresions are hard enough in Python, and since I am new to javascript they are even harder. Well here's the string, thanks for any and all help I receive. document.URL.match(/^(.+?)(?:\?(?:(.*?)@)?(.+))?$/)
12
2052
by: EME | last post by:
typeof new RegExp ---------------------------------------------------- Why (new RegExp) type is function not object very thanks for you consulation
4
3897
by: Matt | last post by:
Hello all, I have just discovered (the long way) that using a RegExp object with the 'global' flag set produces inconsistent results when its test() method is executed. I realize that 'global' is not an appropriate modifier for the test() function - test() searches the entire string by default. However, I would expect it to degrade gracefully. Instead, I seem to be getting something as follows - using W3Schools handy page at :
0
7981
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
8462
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...
0
8320
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...
1
5994
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
5470
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
4011
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2458
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
1
1574
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1315
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.