JDK-8007619.js revision 72:fcf541418304
1100966Siwasaki/*
2100966Siwasaki * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
3100966Siwasaki * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4100966Siwasaki *
5100966Siwasaki * This code is free software; you can redistribute it and/or modify it
6100966Siwasaki * under the terms of the GNU General Public License version 2 only, as
7217365Sjkim * published by the Free Software Foundation.
8217365Sjkim *
9100966Siwasaki * This code is distributed in the hope that it will be useful, but WITHOUT
10100966Siwasaki * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11217365Sjkim * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12217365Sjkim * version 2 for more details (a copy is included in the LICENSE file that
13217365Sjkim * accompanied this code).
14217365Sjkim *
15217365Sjkim * You should have received a copy of the GNU General Public License version
16217365Sjkim * 2 along with this work; if not, write to the Free Software Foundation,
17217365Sjkim * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18217365Sjkim *
19217365Sjkim * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20217365Sjkim * or visit www.oracle.com if you need additional information or have any
21217365Sjkim * questions.
22217365Sjkim */
23217365Sjkim
24217365Sjkim/**
25100966Siwasaki * JDK-8007619: Add support for deprecated properties of RegExp constructor
26217365Sjkim *
27217365Sjkim * @test
28217365Sjkim * @run
29100966Siwasaki */
30217365Sjkim
31217365Sjkim
32217365Sjkimvar emailPattern = /(\w+)@(\w+)\.(\w+)/g;
33217365Sjkimvar input= "Please send mail to foo@acme.com and bar@gov.in ASAP!";
34217365Sjkim
35217365Sjkimvar match = emailPattern.exec(input);
36217365Sjkim
37217365Sjkimwhile (match != null) {
38217365Sjkim    print("Match = " + match);
39217365Sjkim    print("RegExp.lastMatch = " + RegExp.lastMatch);
40217365Sjkim
41217365Sjkim    print("RegExp.$1 = " + RegExp.$1);
42217365Sjkim    print("RegExp.$2 = " + RegExp.$2);
43100966Siwasaki    print("RegExp.$3 = " + RegExp.$3);
44100966Siwasaki
45100966Siwasaki    print("RegExp.lastParen = " + RegExp.lastParen)
46100966Siwasaki    print("RegExp.input = " + RegExp.input);
47193341Sjkim
48100966Siwasaki    match = emailPattern.exec(input);
49100966Siwasaki}
50100966Siwasaki