Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python RegEx Split – re.split()

from re import split

# 'W+' denotes Non-Alphanumeric Characters or group of characters Upon finding ',' or whitespace ' ', the split(), splits the string from that point
print(split('W+', 'Words, words , Words'))
print(split('W+', "Word's words Words"))

# Here ':', ' ' ,',' are not AlphaNumeric thus, the point where splitting occurs
print(split('W+', 'On 5th Jan 1999, at 11:02 AM'))

# 'd+' denotes Numeric Characters or group of characters Splitting occurs at '5', '1999','11', '02' only
print(split('d+', 'On 5th Jan 1999, at 11:02 AM'))
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Python #RegEx #Split
ADD COMMENT
Topic
Name
1+1 =