Child pages
  • RegExp
Skip to end of metadata
Go to start of metadata

Refresh page Mar 28, 2024 15:27

Supported Clients
SmartClient WebClient NGClient MobileClient

Property Summary
Boolean global Specifies if the "g" modifier is set.
Boolean ignoreCase Specifies if the "i" modifier is set.
Number lastIndex An integer specifying the index at which to start the next match.
Boolean multiline Specifies if the "m" modifier is set.
String source The text used for pattern matching.

Methods Summary
String exec(string) Search a string for a specified value.
Boolean test(string) Search a string for a specified value.

Property Details

global

Specifies if the "g" modifier is set.

Returns

Supported Clients

SmartClient,WebClient,NGClient,MobileClient

Sample

var str = 'Visit www.servoy.com';	
var patt1 = new RegExp('www');	
application.output(patt1.global);

ignoreCase

Specifies if the "i" modifier is set.

Returns

Supported Clients

SmartClient,WebClient,NGClient,MobileClient

Sample

var str = 'Visit www.servoy.com';	
var patt1 = new RegExp('www');	
application.output(patt1.ignoreCase);

lastIndex

An integer specifying the index at which to start the next match.

Returns

Supported Clients

SmartClient,WebClient,NGClient,MobileClient

Sample

var str = 'The rain in Spain stays mainly in the plain';	
var patt1 = new RegExp('ain', 'g');	
patt1.test(str);	
application.output('Match found. index now at: ' + patt1.lastIndex);

multiline

Specifies if the "m" modifier is set.

Returns

Supported Clients

SmartClient,WebClient,NGClient,MobileClient

Sample

var str = 'Visit www.servoy.com';	
var patt1 = new RegExp('www','m');	
application.output(patt1.multiline);

source

The text used for pattern matching.

Returns

Supported Clients

SmartClient,WebClient,NGClient,MobileClient

Sample

var str = 'Visit www.servoy.com';	
var patt1 = new RegExp('www.','g');	
application.output('The regular expression is: ' + patt1.source);

Methods Details

exec(string)

Search a string for a specified value. Returns the found value and remembers the position.

Parameters

Object string ;

Returns

String A String representing the found value.

Supported Clients

SmartClient,WebClient,NGClient,MobileClient

Sample

var str='Visit www.servoy.com';
var patt=new RegExp('servoy');
application.output(patt.exec(str));

test(string)

Search a string for a specified value. Returns true or false.

Parameters

Object string ;

Returns

Boolean true if a match was found in the string. false otherwise.

Supported Clients

SmartClient,WebClient,NGClient,MobileClient

Sample

var str='Visit www.servoy.com';	
var patt=new RegExp('soft'); 
application.output(patt.test(str)==true);	
patt.compile('servoy');	
application.output(patt.test(str)==true)

  • No labels