Click or drag to resize

RangeExpression Class

Provides simple numeric range-based string matching.
Inheritance Hierarchy
SystemObject
  Ookii.Jumbo.TopologyRangeExpression

Namespace: Ookii.Jumbo.Topology
Assembly: Ookii.Jumbo (in Ookii.Jumbo.dll) Version: 0.3.0+dc1307f20e065bb638e0b73a34cd216f57e486f1
Syntax
public sealed class RangeExpression

The RangeExpression type exposes the following members.

Constructors
 NameDescription
Public methodRangeExpression Initializes a new instance of the RangeExpression class.
Top
Methods
 NameDescription
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodMatch(String) Matches the specified string against the pattern.
Public methodMatch(String, Boolean) Matches the specified string against the pattern.
Public methodToString Returns a String that represents this instance.
(Overrides ObjectToString)
Top
Remarks

The RangeExpression class allows you to match strings containing ranges of numbers.

String matching is done using a pattern. This pattern, in addition to regular text, can contain numeric ranges of the form "[n-m]" where n and m are both numbers, e.g. "[001-299]". The ranges are inclusive.

The number of characters in the lower bound of the range determines the minimum number of characters; e.g. the expression "foo[001-299]" will match "foo001" but not "foo1", whereas the expression "foo[1-299]" would match either.

The number of characters in the upper bound determines the maximum number of characters; e.g. the expression "foo[1-099] matches "foo050" and "foo50" but not "foo0050".

In addition to ranges, you can also use alternation with the | character. For example, "foo[00-50]|bar[51-99]" will match both e.g. "foo25" and "bar75".

You can also group subexpressions in parentheses for use with alternation. For example "(foo|bar)[00-50]" will match both e.g. "foo25" and "bar25".

See Also