Shaunak Shaunak - 2 months ago 6x
iOS Question

Have different color for first sentence and then the sentence starting after 2 break lines

Please see the attached screenshot that looks similar to Notes iOS app. But here in this the user would be typing in the menu in the

and I want to identify the menu category and have different text color for it. Each menu item would be separated by a single break line. How could I achieve this? Would this be acheivable by using a Regex expression? Any sample code would be very helpful.

enter image description here


The following PCRE-Compitible regex should do the work:


It either matches the first line of your text or a line which follows two newline-characters.