Suppose in MS Word, my text is like below
hello how are you…
In Web page I have used same text like below
<b>hello</b> how are <i>you</i>...
How can i match the string in a web page along with web page.. Currently I am taking the data from copied text from word using
Clipboard() Object.
and Matching text using
createTextRange();
I am pretty sure that this will match the text in a web page. But I am trying to match the text along with formattings..
In the above scenario If i search for “hello how are you” and the bold or italic is not given to any of “how” or “you” that should not match the string.
Please suggest me ways to achieve this. When reading from Clipboard(), How can read along with formattings…
You’re going to have to use regular expressions. And it’s going to be VERY complex. Basically, regular expressions allow you to say things like:
The plus of using regular expressions is also that you can write a simple/short regular expression which will allow for matching a bolded “hello” with:
I’d recommend starting here:
http://www.regular-expressions.info/