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: 2.0.0
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 methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets 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