How can I match text along with formattings of a text in a web page
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
and Matching text using
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…
One Solution collect form web for “How can I match text along with formattings of a text in a web page”
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:
Find me all instances where “hello” occurs between a “<b>” and a “</b>” and is followed by ” how are ” and then “you” within an “<i>” and “</i>”.
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:
//All of these are valid code and a bolded hello in HTML <b>hello</b> <b >hello</b > <B>hello</B>
I’d recommend starting here: