Closed sankaet closed 10 years ago
It does that because of OHASBasicMarkupParser
interpret _
as the markup to underline text it surrounds.
What is odd tough is that it does that even if you don't have a `at the end of the text. Maybe an issue with the RegEx used in
OHASBasicMarkupParser, but I can't see why, as the regex used is
(.+?)which clearly expects an underscore at the end so I don't get what is causing it… Are you sure you don't have any
_` later in your text?
I've same problem too. Also im using OHAttributedLabel for mention and hashtags. But if i ve a text having underscore, all the texts in label be underline. I'm using "(?:\s|\A)[##]+([A-Za-z0-9-_]+)" regex for hashtag. Such as the post content like:
"6 October 2013 , 40-years-old passed on the latest wars fought by #Egypt ,and Egypt still in a state of disarray , and the #Egyptian_citizen still looking forward to a better life of life lived for forty past year , many wars waiting for the Egyptian Citizen, in order to better #education , #health and the #necessities_of_life , Still long way to go ."
Everything normal while "#Egyptian_citizen" hashtag. It's showing it as "#Egyptiancitizen" and underlining starting with "citizen" world and ending with other underscore..
Is it not supporting hashtags with underscore?
How can I solve this problem ?
I'm temporary solved this problem with replacing underscore with three underscore...
I'll try to add word boundary modifiers \\b
around the _(.+?)_
regex, so that _xxx_
only underline the xxx
text if it is an isolated word (surrounded with spaces, end-on-line, carriage return, line feed, whitespace, punctuation… but not another word-character). I'll probably do the same for the bold markup *xxx*
.
You really DO need the Markup parser in addition to your standard hashtag detection? Couln't the hashtag detection suffice?
Fixed in 3.5.0.
I am using the following code and lets say if the string is sank_aet it automatically makes sankaet (with aet underlined). I am not sure why is it doing that. Here is the code