dojo.data.util.filter.patternToRegExp
dojo.require("dojo.data.util.filter");
defined in dojo/data/util/filter.js
Returns a regular expression object that conforms to the defined conversion rules. For example: ca* -> /^ca.$/ ca -> /^.ca.$/ c*a -> /^.c*a.$/ c*a? -> /^.c*a..*$/ and so on.
parameter | type | description |
---|---|---|
pattern | String | string A simple matching pattern to convert that follows basic rules: * Means match anything, so ca* means match anything starting with ca ? Means match single character. So, b?b will match to bob and bab, and so on. \ is an escape character. So for example, \* means do not treat * as a match, but literal character *. To use a \ as a character in the string, it must be escaped. So in the pattern it should be represented by \\ to be treated as an ordinary \ character instead of an escape. |
ignoreCase | Boolean | Optional. An optional flag to indicate if the pattern matching should be treated as case-sensitive or not when comparing By default, it is assumed case sensitive. |