I am having issues to get a string follow by period such as inc. ltd. corp.
. AFAIK to match the .
I should refer it as \.
as in the following example:
\b(inc\.|ltd\.|corp\.|corp)\b(?=(?:.*\s+\w+$))
However, in words such as ABC LTD. BLOCK
, SMALL LTD. ASSOCIATION
, BASIC LTD. REGULAR NAME
is not getting ltd.
, but if changed to \b(inc|ltd|corp)\b
, I am finding ltd.
How can I include .
when searching in a string?
rgx_list= 'inc\.|ltd\.|corp\.'
regex = r'\b({})\b(?=(?:.*\s+\w+$))'.format(rgx_list)
st='ABC LTD. BLOCK'
found = re.findall(regex, st.lower())
Thanks for your guindance