Regex (query directive)

From WandoraWiki
(Difference between revisions)
Jump to: navigation, search
 
Line 1: Line 1:
 
== Description ==
 
== Description ==
  
Includes rows where the active column matches the specified regular expression. Directive can optionally be given a mode parameter which is a bit-wise or of several different options. Available options are Regex.MODE_GLOBAL and Regex.MODE_ICASE. The GLOBAL option causes the regular expression to be matched against the whole input. Otherwise it is sufficient that part of the input matches. The ICASE option causes matching to be performed ignoring case. If no mode is provided, global is assumed, ignore case is not.  
+
Filters and/or performs search and replace operations using regular expressions.
 +
 
 +
Directive can optionally be given a mode parameter which is a bit-wise or of several different options. Available options are Regex.MODE_MATCH, Regex.MODE_GLOBAL and Regex.MODE_ICASE. The MATCH option causes the directive to return an empty result if no match is found. Otherwise rows are returned as is if no match is found. The GLOBAL option causes the regular expression to be matched against the whole input. Otherwise it is sufficient that part of the input matches. The ICASE option causes matching to be performed ignoring case.
 +
 
 +
If a replacement string is given, any matches are replaced with that. Otherwise no replacement is performed and the directive is used only to filter rows. Replacement cannot be used when directive is used as a filtering directive.  
  
 
== Constructor ==
 
== Constructor ==
  
Regex(String regex)
+
Regex(String regex,String replace,int mode)
 +
 
 +
Regex(String regex,String replace) - Uses mode global
 +
 
 +
Regex(String regex) - Uses mode match and global
  
Regex(String regex,int mode)  
+
Regex(String regex,int mode) - Uses the specified mode but forcing match option
  
 
== Notes ==
 
== Notes ==
  
Regex directive can also be used to replace matches with other strings but replacement is not usable when using Regex directive as a filtering directive.  
+
Regular expression syntax is describe in [http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html Java Pattern class documentation]
  
 
[[Category:Query directives]]
 
[[Category:Query directives]]

Revision as of 11:07, 20 August 2009

Description

Filters and/or performs search and replace operations using regular expressions.

Directive can optionally be given a mode parameter which is a bit-wise or of several different options. Available options are Regex.MODE_MATCH, Regex.MODE_GLOBAL and Regex.MODE_ICASE. The MATCH option causes the directive to return an empty result if no match is found. Otherwise rows are returned as is if no match is found. The GLOBAL option causes the regular expression to be matched against the whole input. Otherwise it is sufficient that part of the input matches. The ICASE option causes matching to be performed ignoring case.

If a replacement string is given, any matches are replaced with that. Otherwise no replacement is performed and the directive is used only to filter rows. Replacement cannot be used when directive is used as a filtering directive.

Constructor

Regex(String regex,String replace,int mode)

Regex(String regex,String replace) - Uses mode global

Regex(String regex) - Uses mode match and global

Regex(String regex,int mode) - Uses the specified mode but forcing match option

Notes

Regular expression syntax is describe in Java Pattern class documentation

Personal tools