Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python remove articles from string regex

# credit to the Stack Overflow user in the source link

re.sub('(s+)(a|an|and|the)(s+)', '13', text) # leaves the residual whitespace

re.sub('s+(a|an|and|the)(s+)', '2', text) # removes the whitespace
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #remove #articles #string #regex
ADD COMMENT
Topic
Name
6+5 =