GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
JE::Object::RegExp(3) User Contributed Perl Documentation JE::Object::RegExp(3)

JE::Object::RegExp - JavaScript regular expression (RegExp object) class

  use JE;
  use JE::Object::RegExp;

  $j = new JE;

  $js_regexp = new JE::Object::RegExp $j, "(.*)", 'ims';

  $perl_qr = $js_regexp->value;

  $some_string =~ $js_regexp; # You can use it as a qr//

This class implements JavaScript regular expressions for JE.

See JE::Types for a description of most of the interface. Only what is specific to JE::Object::RegExp is explained here.

A RegExp object will stringify the same way as a "qr//", so that you can use "=~" on it. This is different from the return value of the "to_string" method (the way it stringifies in JS).

Since JE's regular expressions use Perl's engine underneath, the features that Perl provides that are not part of the ECMAScript spec are supported, except for "(?s)" and "(?m)", which don't do anything, and "(?|...)", which is unpredictable.

In versions prior to 0.042, a hyphen adjacent to "\d", "\s" or "\w" in a character class would be unpredictable (sometimes a syntax error). Now it is interpreted literally. This matches what most implementations do, which happens to be the same as Perl's behaviour. (It is a syntax error in ECMAScript.)

value
Returns a Perl "qr//" regular expression.

If the regular expression or the string that is being matched against it contains characters outside the Basic Multilingual Plane (whose character codes exceed 0xffff), the behavior is undefined--for now at least. I still need to solve the problem caused by JS's unintuitive use of raw surrogates. (In JS, "/../" will match a surrogate pair, which is considered to be one character in Perl. This means that the same regexp matched against the same string will produce different results in Perl and JS.)

class
Returns the string 'RegExp'.

JE
JE::Types
JE::Object
2014-10-20 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.