Child pages
  • RegExp

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{hidden}
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY, UNLESS YOU KNOW WHAT YOU'RE DOING.
		THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO EXTRACT CHANGES FROM THE PAGE AND MERGE THEM BACK INTO SERVOY SOURCE{hidden}
{sub-section:description|text=}{sub-section}\\ 

{table:id=|class=servoy sSummary}{colgroup}{column:width=80px|padding=0px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Property Summary{th}{tr}{tbody}{tr}{td}[Boolean]{td}{td}[#global]
Specifies if the "g" modifier is set.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#ignoreCase]
Specifies if the "i" modifier is set.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#lastIndex]
An integer specifying the index at which to start the next match.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#multiline]
Specifies if the "m" modifier is set.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#source]
The text used for pattern matching.{td}{tr}{tbody}{table}\\ 

{table:id=|class=servoy sSummary}{colgroup}{column:width=80px|padding=0px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Method Summary{th}{tr}{tbody}{tr}{td}[String]{td}{td}[#exec]\(string)
Search a string for a specified value.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#test]\(string)
Search a string for a specified value.{td}{tr}{tbody}{table}\\ 

{table:id=property|class=servoy sDetail}{colgroup}{column:width=100%|padding=0px}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Property Details{th}{tr}{tbody:id=global|class=node}{tr:id=name}{td}h6.global{td}{tr}{builder-show:permission=edit}{tr:id=des}{td}{sub-section:global_des|trigger=button|text=}{sub-section}{sub-section:global_des|trigger=none|class=sIndent}SpecifiesReplace if the "g" modifier is set.with description{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:global_snc|trigger=button|text=}{sub-section}{sub-section:global_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:global_prs|trigger=button|text=}{sub-section}{sub-section:global_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:global_ret|trigger=button|text=}{sub-section}{sub-section:global_ret|trigger=none|class=sIndent}[Boolean]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:global_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:global_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:global_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:global_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:global_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:global_sam|trigger=none}{code:language=javascript}
var str = 'Visit www.servoy.com';	
var patt1 = new RegExp('www');	
application.output(patt1.global);
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=ignoreCase|class=node}{tr:id=name}{td}h6.ignoreCase{td}{tr}{builder-show:permission=edit}{tr:id=des}{td}{sub-section:ignoreCase_des|trigger=button|text=}{sub-section}{sub-section:ignoreCase_des|trigger=none|class=sIndent}SpecifiesReplace if the "i" modifier is set.with description{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:ignoreCase_snc|trigger=button|text=}{sub-section}{sub-section:ignoreCase_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:ignoreCase_prs|trigger=button|text=}{sub-section}{sub-section:ignoreCase_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:ignoreCase_ret|trigger=button|text=}{sub-section}{sub-section:ignoreCase_ret|trigger=none|class=sIndent}[Boolean]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:ignoreCase_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:ignoreCase_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:ignoreCase_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:ignoreCase_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:ignoreCase_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:ignoreCase_sam|trigger=none}{code:language=javascript}
var str = 'Visit www.servoy.com';	
var patt1 = new RegExp('www');	
application.output(patt1.ignoreCase);
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=lastIndex|class=node}{tr:id=name}{td}h6.lastIndex{td}{tr}{builder-show:permission=edit}{tr:id=des}{td}{sub-section:lastIndex_des|trigger=button|text=}{sub-section}{sub-section:lastIndex_des|trigger=none|class=sIndent}AnReplace integer specifying the index at which to start the next match.with description{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:lastIndex_snc|trigger=button|text=}{sub-section}{sub-section:lastIndex_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:lastIndex_prs|trigger=button|text=}{sub-section}{sub-section:lastIndex_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:lastIndex_ret|trigger=button|text=}{sub-section}{sub-section:lastIndex_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:lastIndex_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:lastIndex_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:lastIndex_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:lastIndex_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:lastIndex_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:lastIndex_sam|trigger=none}{code:language=javascript}
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);
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=multiline|class=node}{tr:id=name}{td}h6.multiline{td}{tr}{builder-show:permission=edit}{tr:id=des}{td}{sub-section:multiline_des|trigger=button|text=}{sub-section}{sub-section:multiline_des|trigger=none|class=sIndent}SpecifiesReplace if the "m" modifier is set.with description{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:multiline_snc|trigger=button|text=}{sub-section}{sub-section:multiline_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:multiline_prs|trigger=button|text=}{sub-section}{sub-section:multiline_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:multiline_ret|trigger=button|text=}{sub-section}{sub-section:multiline_ret|trigger=none|class=sIndent}[Boolean]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:multiline_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:multiline_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:multiline_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:multiline_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:multiline_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:multiline_sam|trigger=none}{code:language=javascript}
var str = 'Visit www.servoy.com';	
var patt1 = new RegExp('www','m');	
application.output(patt1.multiline);
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=source|class=node}{tr:id=name}{td}h6.source{td}{tr}{builder-show:permission=edit}{tr:id=des}{td}{sub-section:source_des|trigger=button|text=}{sub-section}{sub-section:source_des|trigger=none|class=sIndent}TheReplace text used for pattern matching.{subwith description{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:source_snc|trigger=button|text=}{sub-section}{sub-section:source_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:source_prs|trigger=button|text=}{sub-section}{sub-section:source_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:source_ret|trigger=button|text=}{sub-section}{sub-section:source_ret|trigger=none|class=sIndent}[String]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:source_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:source_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:source_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:source_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:source_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:source_sam|trigger=none}{code:language=javascript}
var str = 'Visit www.servoy.com';	
var patt1 = new RegExp('www.','g');	
application.output('The regular expression is: ' + patt1.source);
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}\\ 

{table:id=function|class=servoy sDetail}{colgroup}{column:width=100%|padding=0px}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Method Details{th}{tr}{tbody:id=exec|class=node}{tr:id=name}{td}h6.exec{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[String]{span}{span:id=iets|style=float: left; font-weight: bold;}exec{span}{span:id=iets|style=float: left;}\(string){span}{td}{tr}{builder-show:permission=edit}{tr:id=des}{td}{sub-section:exec_des|trigger=button|text=}{sub-section}{sub-section:exec_des|trigger=none|class=sIndent}SearchReplace a string for a specified value. Returns the found value and remembers the position.with description{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:exec_snc|trigger=button|text=}{sub-section}{sub-section:exec_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:exec_prs|trigger=button|text=}{sub-section}{sub-section:exec_prs|trigger=none|class=sIndent}\{[Object]} string
{sub-section}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:exec_ret|trigger=button|text=}{sub-section}{sub-section:exec_ret|trigger=none|class=sIndent}[String] -- A String representing the found value.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:exec_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:exec_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:exec_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:exec_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:exec_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:exec_sam|trigger=none}{code:language=javascript}
var str='Visit www.servoy.com';
var patt=new RegExp('servoy');
application.output(patt.exec(str));
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=test|class=node}{tr:id=name}{td}h6.test{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}test{span}{span:id=iets|style=float: left;}\(string){span}{td}{tr}{builder-show:permission=edit}{tr:id=des}{td}{sub-section:test_des|trigger=button|text=}{sub-section}{sub-section:test_des|trigger=none|class=sIndent}SearchReplace a string for a specified value. Returns true or false.with description{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:test_snc|trigger=button|text=}{sub-section}{sub-section:test_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:test_prs|trigger=button|text=}{sub-section}{sub-section:test_prs|trigger=none|class=sIndent}\{[Object]} string
{sub-section}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:test_ret|trigger=button|text=}{sub-section}{sub-section:test_ret|trigger=none|class=sIndent}[Boolean] -- true if a match was found in the string. false otherwise.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:test_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:test_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:test_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:test_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:test_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:test_sam|trigger=none}{code:language=javascript}
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)
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}