I have added a GREP query (?<=-).\w+ into the paragraph style with No_break character style to keep the hyphenated words together. When applied this in to URL, it breaks like following. Please look at the red color highlighted part. A single word and breaks an on first line and d on second line. It happens only on hyperlink text with two consequtive hyphenated words. Can you please help me on this how to fix this. Thanks a lot in advance.
Something is very odd here. I think I can see what you are trying to do - you want your long URL to break only at hyphens, correct? So you are trying to apply a No Break charstyle with a GREP style. That ought to work, but it doesn't. I have found a few different ways to recreate your issue over here on my install of CS5.5.
I can manually apply No Break - which causes words in the URL to break, and not at hyphens, just as in your screenshot. That shouldn't happen. The same is true of manually applying the No Break charstyle. I suspect that we are backing the Paragrpah Composer into a corner by using so much No Break. In fact, if I set up a very long URL marked as No Language, using a bunch of hyphens, it breaks correctly, until I apply No Break to all of the text separated by hyphens.
How about this? Stop using No Break; instead, insert a zero-width space after each hyphen. I used a GREP search (not a GREP style) to replace all hyphens with a hyphen followed by a zero-width space:
This doesn't answer why the prolific use of No Break caused such an error. It worries me, because I regularly apply No Break via GREP style to prevent improper line breaks in languages like Lao and Burmese. It's worked in all my tests (which I have my translators proofread), so I wonder why it's not working here.