Java Reference
In-Depth Information
Nashorn contains several built-in global objects and functions.
Object
,
Function
,
String
,
Number
, and
Boolean
are examples of built-in objects.
parseInt()
,
parseFloat()
,
load()
, and
loadWithNewGlobal()
are examples of global functions.
A regular expression represents a pattern in text. Nashorn contains a
RegExp
built-in
object whose instances represent regular expressions. You can also use regular expression
literals to represent
RegExp
objects. A regular expression literal is enclosed in forward
slashes and optionally followed by flags that define high-level text matching rules.
/Java/gi
is an example of a regular expression literal that will perform a global, case-insensitive
match for the text
Java
. The
RegExp
object contains
test()
and
exec()
method to
perform matches on input text. Several methods such as
replace()
and
match()
of the
String
object take regular expressions as arguments to perform operation such as match
and find-and-replace.
Search WWH ::
Custom Search