Is there a posibility to write a regular expresion to match a "c" or a "ç" to work for both examples like
var a = "ca va";
var b = "ça va";
Regex.Match(a,"\b(ca\sva)").Success // Match
Regex.Match(b,"\b(ça\sva)").Success // Dont match
Thanks
Is there a posibility to write a regular expresion to match a "c" or a "ç" to work for both examples like
var a = "ca va";
var b = "ça va";
Regex.Match(a,"\b(ca\sva)").Success // Match
Regex.Match(b,"\b(ça\sva)").Success // Dont match
Thanks
For me, the following code returns true in either case:
using System;
using System.Text.RegularExpressions;
namespace FrenchRegex
{
class Program
{
static void Main(string[] args)
{
var a = "ca va";
var b = "ça va";
var regex = @"\b((c|ç)a\sva)";
var matchA = Regex.Match(a, regex).Success;
var matchB = Regex.Match(b, regex).Success;
Console.WriteLine("Matches '" + a + "': " + matchA);
Console.WriteLine("Matches '" + b + "': " + matchB);
Console.ReadKey();
}
}
}
I copied and pasted into VS2010, so you might need to do the same to reproduce my result.
In any case, I think a regex that matches both "ça va" and "ca va" would be \b([cç]a\sva)
.