# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"Other\spayables?_lt"
test_str = ("FRONTKEN CORPORATION BERHAD \n"
"(Co. No. 651020-T) \n"
"(Incorporated in Malaysia) \n"
"CONDENSED CONSOLIDATED STATEMENT OF PROFIT OR LOSS AND OTHER \n"
"COMPREHENSIVE INCOME FOR THE FOURTH QUARTER ENDED 31 DECEMBER 2019 \n"
"(The figures have not been audited) \n"
"Individual Quarter Cumulative Quarter\n"
"Preceding Year Preceding Year\n"
"Current Year Corresponding Current Year Corresponding\n"
"Quarter Quarter To-date Period\n"
"31 Dec 2019 31 Dec 2018 31 Dec 2019 31 Dec 2018\n"
"RM '000 RM '000 RM '000 RM '000\n"
"Revenue 8 8,888 88,665 339,911 327,218\n"
"Operating expenses (61,106) ( 61,255) ( 228,967) ( 239,240)\n"
" Profit before depreciation and finance costs 2 7,782 2 7,410 110,944 8 7,978\n"
"Depreciation (3,760) (4,268) ( 17,818) (17,301)\n"
"Finance costs (140) (92) (756) (568)\n"
"Other operating income 608 1 ,375 3 ,891 5,428\n"
"Share of results of associated companies - - - 78\n"
"Profit before tax 2 4,490 2 4,425 9 6,261 7 5,615\n"
"Taxation (4,905) (4,415) ( 22,033) (18,613)\n"
"Profit after tax 1 9,585 2 0,010 7 4,228 5 7,002\n"
"Profit after tax attributable to :\n"
"Owners of the Company 1 8,199 1 8,683 6 9,170 5 2,257\n"
"Non-controlling interests 1 ,386 1 ,327 5 ,058 4 ,745\n"
"Profit for the period 1 9,585 2 0,010 7 4,228 5 7,002\n"
"Profit for the period 1 9,585 2 0,010 7 4,228 5 7,002\n"
"Other comprehensive expenses:\n"
"Actuarial gains 4 3 98 4 3 98\n"
"Foreign currency translation 2 ,253 7 2 2 ,262 ( 1,571)\n"
"Total comprehensive income for the period 2 1,842 2 0,480 7 6,494 5 5,829\n"
"Total comprehensive income attributable to:\n"
"Owners of the Company 2 0,277 1 9,172 7 1,291 5 1,317\n"
"Non-controlling interests 1 ,565 1 ,308 5 ,203 4 ,512\n"
"Total comprehensive income for the period 2 1,842 2 0,480 7 6,494 5 5,829\n"
"Earnings per share attributable to \n"
"equity holders of the company :\n"
"Basic (sen) 1.74 1.78 6.60 4.99\n"
"The condensed consolidated income statement is to be read in conjunction with the accompanying notes to the interim financial report.\n"
"The comparative figures are based on audited financial statements of the Company for the financial year ended 31 December 2018.")
matches = re.finditer(regex, test_str, re.MULTILINE | re.IGNORECASE)
for matchNum, match in enumerate(matches, start=1):
print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
for groupNum in range(0, len(match.groups())):
groupNum = groupNum + 1
print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))
# Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html