.NET Framework Bookmark and Share   
 index > Regular Expressions > Regexoption ECMAScript
 

Regexoption ECMAScript

so ECMAScript option can't be used with Explicit Capture? I would find Ignore case+ Explict capture + ECMAScript very useful

According to online help, This value (ECMAScript) can be used only in conjunction with the IgnoreCase, Multiline, and Compiled values
  • Edited byfs - new to w7 Monday, August 31, 2009 10:47 PMfix title spelling
  •  
fs - new to w7

To quote from Jeffrey Friedl

ECMAScript is a standardized version of JavaScript with its own semantics of how regular expressions should be parsed and applied. A .NET regex attempts to mimic those semantics if created with the RegexOptions.ECMAScript option. If you don't know what ECMAScript is, or don't need compatibility with it, you can safely ignore this section.

ECMA stands for "European Computer Manufacturers Association," a group formed in 1960 to standardize aspects of the growing field of computers.

When RegexOptions.ECMAScript is in effect, the following apply:

Only the following may be combined with RegexOptions.ECMAScript:
RegexOptions.IgnoreCase
RegexOptions.Multiline
RegexOptions.Compiled

\w, \d, and \s (and \W, \D, and \S) change to ASCII-only matching.

When a backslash-digit sequence is found in a regex, the ambiguity between backreference and octal escape changes to favor a backreference, even if that means having to ignore some of the trailing digits. For example, with (?)\10, the \10 is taken as a backreference to the first group, followed by a literal '0'.


John Grove - TFD Group, Senior Software Engineer, EI Division, http://www.tfdg.com
JohnGrove

To quote from Jeffrey Friedl

ECMAScript is a standardized version of JavaScript with its own semantics of how regular expressions should be parsed and applied. A .NET regex attempts to mimic those semantics if created with the RegexOptions.ECMAScript option. If you don't know what ECMAScript is, or don't need compatibility with it, you can safely ignore this section.

ECMA stands for "European Computer Manufacturers Association," a group formed in 1960 to standardize aspects of the growing field of computers.

When RegexOptions.ECMAScript is in effect, the following apply:

Only the following may be combined with RegexOptions.ECMAScript:
RegexOptions.IgnoreCase
RegexOptions.Multiline
RegexOptions.Compiled

\w, \d, and \s (and \W, \D, and \S) change to ASCII-only matching.

When a backslash-digit sequence is found in a regex, the ambiguity between backreference and octal escape changes to favor a backreference, even if that means having to ignore some of the trailing digits. For example, with (?)\10, the \10 is taken as a backreference to the first group, followed by a literal '0'.


John Grove - TFD Group, Senior Software Engineer, EI Division, http://www.tfdg.com
JohnGrove
Thank you.

I now understand why ECMAScript and explicit capture don't mix as javascript and other non .net regex tend not to have explicit capture.

fs - new to w7
Very helpful. Can you provide a link to the citation for further research? Thx.
Les Potter, Xalnix Corporation, Yet Another C# Blog
xalnix
Mastering Regular Expressions 3rd Edition
Chapter 9, .NET 9.1.1.6. ECMAScript mode [eBook]

Or page 412 in the book.


John Grove - TFD Group, Senior Software Engineer, EI Division, http://www.tfdg.com
JohnGrove

You can use google to search for other answers

Custom Search

More Threads

• Regular Expression
• Read from HTML Page then format into Listbox
• Range Generator
• Extracting the mached text
• Regex to get href="#"
• directive or assembly reference for exception
• Validate two consecutive integers
• Translate operator
• Regular Expression help
• Hyperlink validation for Excel export