Hi Bala,
For the word
midnight:
([A-z]{1,})([a-z]{1,})
for the word
mid might:
([A-z]{1,})\s([a-z]{1,}) or ([A-z]{1,}) ([a-z]{1,})
Its not a big deal right? ;-)
If you want to test or validate regex string refer this
link[
^]
Suggestion after updating the question
You need to get words on Word basis not on regex pattern basis,am right? to explain clear If you have another word
mid-day in that paragraph which has similar pattern to
mid-night, then that word also retrieved if you use regex pattern... do I make sense here?
Is that what you want?
Updated solution:
Works for all except white space right? little bit overhead,but do-able...
for the above requirement if you select
midnight,then
put is as compare string with whole passage.if the right side of the string has any special character like
('space','-')then replace the string with empty character('') and compare with the word 'midnight' if it matches then highlight that word if its not then move on to another word...
Refer this
link[
^] for your reference
And you can refer this
link [
^]also, it gives you direct solution I believe.....
Have fun.....
Hope this helps you a bit.
Regards,
RK