MrC-temp: Difference between revisions
mNo edit summary |
No edit summary |
||
Line 23: | Line 23: | ||
|- valign="top" |
|- valign="top" |
||
! scope="row" style="background: #A8E4A0; color: black; border: 1px solid black;" | Examples |
! scope="row" style="background: #A8E4A0; color: black; border: 1px solid black;" | Examples |
||
|style="background: #ecfeea; color: black; border: 1px solid black" | '''Examples |
|style="background: #ecfeea; color: black; border: 1px solid black" | '''Examples: Modes 1 to 9''' |
||
The examples in this section use one of the modes from 1 through 9, to output the specified capture. |
|||
'''Regex([Name], /#(Big.*Man)#/, 1)'''<br /> |
'''Regex([Name], /#(Big.*Man)#/, 1)'''<br /> |
||
Line 48: | Line 50: | ||
---- |
---- |
||
'''Examples |
'''Examples: Mode 0''' |
||
'''if(Regex([Artist],/#([<nowiki>[:punct:]]</nowiki>)#/, 0),[R1] --> [Artist],No Punctuation)'''<br>''Matches against the Artist field looking for any punctuation character. The results of the Regex() expression will be a 0 (false) or 1 (true) since the mode is set to 0, The true side of the if() test is set to output the first (and only) capture, which is expressed as [R1], and is followed by the string " --> " and then the artist name. In the false case, the string "No Punctuation" is output.'' |
'''if(Regex([Artist],/#([<nowiki>[:punct:]]</nowiki>)#/, 0),[R1] --> [Artist],No Punctuation)'''<br>''Matches against the Artist field looking for any punctuation character. The results of the Regex() expression will be a 0 (false) or 1 (true) since the mode is set to 0, The true side of the if() test is set to output the first (and only) capture, which is expressed as [R1], and is followed by the string " --> " and then the artist name. In the false case, the string "No Punctuation" is output.'' |
||
Line 77: | Line 79: | ||
---- |
---- |
||
'''Examples |
'''Examples: Mode -1''' |
||
'''Regex([Name], /#(\d{1,2})\.(\d{1,2}).(\d{4})#/, -1)[R3]//[R1]//[R2]</nowiki>'''<br /> |
'''Regex([Name], /#(\d{1,2})\.(\d{1,2}).(\d{4})#/, -1)[R3]//[R1]//[R2]</nowiki>'''<br /> |
Revision as of 15:18, 28 August 2011
Note: The File Properties page is now at its permanent home ==> File_Properties_(tags)
Note: This is MrC's working space for Wiki page work-in-progress.
Regex(...): Regular expression pattern matching
Regex() | This function performs regular expression (RE) pattern matching on its input. It can be used in one of three different modes: a test mode to test for a match, a capture output mode to output the specified captured pattern, and a silent, capture-only mode. All match captures are placed into special variables referenced as [R1], [R2], ... [R9], which can be used in subsequent expressions. The contents of the captures [R1] ... [R9] are available until the entire expression completes, or Regex() is run again, whereby they are replaced. (Available since build 16.0.155.) |
---|---|
Construction | Regex(String to test, Regular expression, Mode, Case sensitivity)
|
Examples | Examples: Modes 1 to 9
The examples in this section use one of the modes from 1 through 9, to output the specified capture. Regex([Name], /#(Big.*Man)#/, 1)
Regex([Artist], /#([(].+)$#/, 1) Sample output:
Regex([Name], /#([(][^)]+)$#/, 1) Sample output:
Examples: Mode 0 if(Regex([Artist],/#([[:punct:]])#/, 0),[R1] --> [Artist],No Punctuation) Sample output:
A more complex example that removes semicolon and backslash characters, which cause problems when building a list... if(Regex([Artist], /#([[:punct:]])#/, 0), Contains Punctuation\replace(replace([R1], ;,Semicolon), \, Backslash), No Punctuation)\replace(replace([Artist], ;, / and/ ), \, //)&DataType=[list] Examples: Mode -1 Regex([Name], /#(\d{1,2})\.(\d{1,2}).(\d{4})#/, -1)[R3]//[R1]//[R2]</nowiki>
... IN PROGRESS ... |