ios - NSRegularExpression change following text's color after a character -


i trying change character's color , text comes , using nsregularexpression character , have no idea how can change following characters example here text :

● title...... description xxxxxx x x x x x   

so in case need change ● character's color , following strings

here code :

 nsregularexpression *regex2 = [nsregularexpression regularexpressionwithpattern:@"●"                                    options:kniloptions error:nil];  [regex2 enumeratematchesinstring:puretext options:kniloptions range:range usingblock:^(nstextcheckingresult *result, nsmatchingflags flags, bool *stop) {     nsrange substringrange = [result rangeatindex:0];     [stringtext addattribute:nsforegroundcolorattributename value:[uicolor orangecolor] range:substringrange]; }];  _textview.attributedtext = stringtext; 

this code finds , changes ● character's color .

use regex ●.* match characters after dot before newline:

nsregularexpression *regex2 = [nsregularexpression regularexpressionwithpattern:@"●.*"                                    options:kniloptions error:nil];  [regex2 enumeratematchesinstring:puretext options:kniloptions range:range usingblock:^(nstextcheckingresult *result, nsmatchingflags flags, bool *stop) {     nsrange substringrange = [result rangeatindex:0];     [stringtext addattribute:nsforegroundcolorattributename value:[uicolor orangecolor] range:substringrange]; }];  _textview.attributedtext = stringtext; 

Comments

Popular posts from this blog

html - height not adding height to a empty div -

Oracle SQL. How to select specific IDs where value of columns specify criteria? -

python - Robot Framework location and name of keyword -