Please help.
I have a code. The code searches @"<(3)[-^~]([1-4])[-^~]([1-4])[-^~]([0-9]{1;3})?([0-9]{2})>" //(strings like 3-2-1-123-15 )
and puts the hyperlinks on it. But imagine, if the
3-2-1-123-15
has NON-BREAKING HYPHEN between numbers. If I put range to text (string s = rng.Text;
)(I need it because I am using the same string in my hyperlink: rngFound.Range.Hyperlinks.Add(rngFound.Range, hyperlink + rngFound.Text));
then I will have:
32112315
situation. But how can I have string with "-". I mean how can I replace NON-BREAKING HYPHEN with "-". Do I need to replace it in the word text?(It is not very good). And if I do then how can I do that using function:
Word.Selection FindAndReplace2(Word.Selection rngToSearch, object findText, object replaceWithText) //Find function
{
bool found = false;
//options
object matchCase = false;
object matchWholeWord = true;
object matchWildCards = true;
object matchSoundsLike = false;
object matchAllWordForms = false;
object forward = true;
object format = false;
object matchKashida = false;
object matchDiacritics = false;
object matchAlefHamza = false;
object matchControl = false;
object read_only = false;
object visible = true;
object replace = true;
object wrap = Word.WdFindWrap.wdFindStop; ;
//execute find and replace
found = rngToSearch.Find.Execute(ref findText, ref matchCase, ref matchWholeWord,
ref matchWildCards, ref matchSoundsLike, ref matchAllWordForms, ref forward, ref wrap, ref format, ref replaceWithText, ref replace,
ref matchKashida, ref matchDiacritics, ref matchAlefHamza, ref matchControl);
if (!found)
{
rngToSearch = null;
}
return rngToSearch;