Replacing and Splitting
Replace
The System.Text.RegularExpressions.Regex
Class provides several overloads of replace
. The same overloads are available in the FsRegEx
class and as individually
named functions, including overloads and functions using RegexOptions
. Timeout
is not supported at this time.
simple replacement of all occurence
1: 2: 3: 4: 5: 6: 7: 8: 9: |
|
replace max time starting at
Replaces a specified maximum number of strings starting at location that match a regular expression pattern with a specified replacement string.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: |
|
replace with MatchEvaluator
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: |
|
Splitting
The System.Text.RegularExpressions.Regex
Class provides several overloads of split
to split strings into arrays. The same overloads are available in the FsRegEx
class and as individually
named functions, including overloads and functions using RegexOptions
. Timeout
is not supported at this time.
split with Regex option
1: 2: 3: 4: 5: 6: 7: 8: 9: |
|
namespace System
namespace System.Text
namespace System.Text.RegularExpressions
val printfn : format:Printf.TextWriterFormat<'T> -> 'T
type RegexOptions =
| None = 0
| IgnoreCase = 1
| Multiline = 2
| ExplicitCapture = 4
| Compiled = 8
| Singleline = 16
| IgnorePatternWhitespace = 32
| RightToLeft = 64
| ECMAScript = 256
| CultureInvariant = 512
| None = 0
| IgnoreCase = 1
| Multiline = 2
| ExplicitCapture = 4
| Compiled = 8
| Singleline = 16
| IgnorePatternWhitespace = 32
| RightToLeft = 64
| ECMAScript = 256
| CultureInvariant = 512
field RegexOptions.Multiline: RegexOptions = 2
val capText : m:Match -> string
val m : Match
type Match =
inherit Group
member Groups : GroupCollection
member NextMatch : unit -> Match
member Result : replacement:string -> string
static member Empty : Match
static member Synchronized : inner:Match -> Match
inherit Group
member Groups : GroupCollection
member NextMatch : unit -> Match
member Result : replacement:string -> string
static member Empty : Match
static member Synchronized : inner:Match -> Match
val x : string
property Capture.Value: string
type Char =
struct
member CompareTo : value:obj -> int + 1 overload
member Equals : obj:obj -> bool + 1 overload
member GetHashCode : unit -> int
member GetTypeCode : unit -> TypeCode
member ToString : unit -> string + 1 overload
static val MaxValue : char
static val MinValue : char
static member ConvertFromUtf32 : utf32:int -> string
static member ConvertToUtf32 : highSurrogate:char * lowSurrogate:char -> int + 1 overload
static member GetNumericValue : c:char -> float + 1 overload
...
end
struct
member CompareTo : value:obj -> int + 1 overload
member Equals : obj:obj -> bool + 1 overload
member GetHashCode : unit -> int
member GetTypeCode : unit -> TypeCode
member ToString : unit -> string + 1 overload
static val MaxValue : char
static val MinValue : char
static member ConvertFromUtf32 : utf32:int -> string
static member ConvertToUtf32 : highSurrogate:char * lowSurrogate:char -> int + 1 overload
static member GetNumericValue : c:char -> float + 1 overload
...
end
Char.IsLower(c: char) : bool
Char.IsLower(s: string, index: int) : bool
Char.IsLower(s: string, index: int) : bool
Char.ToUpper(c: char) : char
Char.ToUpper(c: char, culture: Globalization.CultureInfo) : char
Char.ToUpper(c: char, culture: Globalization.CultureInfo) : char
String.Substring(startIndex: int) : string
String.Substring(startIndex: int, length: int) : string
String.Substring(startIndex: int, length: int) : string
property String.Length: int
type MatchEvaluator =
delegate of Match -> string
delegate of Match -> string
field RegexOptions.IgnoreCase: RegexOptions = 1
type Array =
member Clone : unit -> obj
member CopyTo : array:Array * index:int -> unit + 1 overload
member GetEnumerator : unit -> IEnumerator
member GetLength : dimension:int -> int
member GetLongLength : dimension:int -> int64
member GetLowerBound : dimension:int -> int
member GetUpperBound : dimension:int -> int
member GetValue : [<ParamArray>] indices:int[] -> obj + 7 overloads
member Initialize : unit -> unit
member IsFixedSize : bool
...
member Clone : unit -> obj
member CopyTo : array:Array * index:int -> unit + 1 overload
member GetEnumerator : unit -> IEnumerator
member GetLength : dimension:int -> int
member GetLongLength : dimension:int -> int64
member GetLowerBound : dimension:int -> int
member GetUpperBound : dimension:int -> int
member GetValue : [<ParamArray>] indices:int[] -> obj + 7 overloads
member Initialize : unit -> unit
member IsFixedSize : bool
...
val iter : action:('T -> unit) -> array:'T [] -> unit