Share
BOX8 | Write a regular expression to split a paragraph every time it finds an exclamation mark
Question
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Answers ( 5 )
paragraph.split(“!”)
You can use the .split() method to split any string you pass on to
the function. The argument you pass on to the split function acts as
a delimiter and your string will be tokenized on the basis of the argument.
If no argument is provided, it takes white-space as the separator.
Ex :
suppose you have a string in str variable.
str.split(“!”)
str.split(“!”)
paragraph.split(‘!’)
str.split(“!”)