I'm working on a minor side project in F# which involves porting existing C# code to F# and I've seemingly come across a difference in how regular expressions are handled between the two languages (I'm posting this to hopefully find out I am just doing something wrong).
This minor function simply detects surrogate pairs using the regular expression trick outlined here. Here's the current implementation:
let isSurrogatePair input =
Regex.IsMatch(input, "[\uD800-\uDBFF][\uDC00-\uDFFF]")
If I then execute it against a known surrogate pair like this:
let result = isSurrogatePair "野"
printfn "%b" result
I get false
in the FSI window.
If I use the equivalent C#:
public bool IsSurrogatePair(string input)
{
return Regex.IsMatch(input, "[\uD800-\uDBFF][\uDC00-\uDFFF]");
}
And the same input value, I (correctly) get true
back.
Is this a true issue? Am I simply doing something wrong in my F# implementation?