Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python regex get string before character

You don't need regex for this

>>> s = "Username: How are you today?"
You can use the split method to split the string on the ':' character

>>> s.split(':')
['Username', ' How are you today?']
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #regex #string #character
ADD COMMENT
Topic
Name
4+2 =