What is ECMAScript

A

Academia

Regex class has the option ECMAScript which can set.

I searched the Internet and got about a million hits that reference
ECMAScript but none that defined it.

Can you tell me what it is used for.

I let the user of my text editor search using regular expressions and do not
know if I should set that option or not. What would seem the most natural
for him, set or not set?



Thanks
 
T

Tom Shelton

Regex class has the option ECMAScript which can set.

I searched the Internet and got about a million hits that reference
ECMAScript but none that defined it.

ECMAScript is another name for what you may know as JavaScript (or
JScript as MS calls it). ECMA standardized JavaScript, and ECMAScript
is the formal name.
Can you tell me what it is used for.

Anything you would use JavaScript for :) So, client side browser
scripting is probably the most common use - but, you can use
javascript to write wsh scripts to automate tasks in windows.
I let the user of my text editor search using regular expressions and do not
know if I should set that option or not. What would seem the most natural
for him, set or not set?

Not sure about this part....
 
M

Martin Honnen

Academia said:
Regex class has the option ECMAScript which can set.

I searched the Internet and got about a million hits that reference
ECMAScript but none that defined it.

Can you tell me what it is used for.

I let the user of my text editor search using regular expressions and do not
know if I should set that option or not. What would seem the most natural
for him, set or not set?

ECMAScript (edition 3) defines a regular expression language that is not
as powerful as the .NET regular epxression language. For instance the
range the \w character class covers differs between the .NET regular
expression language and the ECMAScript regular expression language:

string s = "ä";
string pattern = @"^\w+$";
Console.WriteLine(Regex.IsMatch(s, pattern));
Console.WriteLine(Regex.IsMatch(s, pattern,
RegexOptions.ECMAScript));

Unless you have users that expect the ECMAScript semantics for their
regular expressions I don't think you should set that flag.
 
A

Academia

Thanks that help a lot
Regex class has the option ECMAScript which can set.

I searched the Internet and got about a million hits that reference
ECMAScript but none that defined it.

ECMAScript is another name for what you may know as JavaScript (or
JScript as MS calls it). ECMA standardized JavaScript, and ECMAScript
is the formal name.
Can you tell me what it is used for.

Anything you would use JavaScript for :) So, client side browser
scripting is probably the most common use - but, you can use
javascript to write wsh scripts to automate tasks in windows.
I let the user of my text editor search using regular expressions and do
not
know if I should set that option or not. What would seem the most natural
for him, set or not set?

Not sure about this part....
 
A

Academia

Thanks for all the detail.

I copied it as a comment into my code for reference.

Also ran the example an in case anyone else reads this it results in:
True
False

Thanks again
 

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

Top