- 1
Is it possible to use the regex modules search function to find the subsequence of a subtring in a string? Below is the example
2 Réponses
0
String: Gegeeks
Substring: ge
Number of ge in string: 5
(Ge)geeks - 1
(G)eg(e)eks - 2
(G)ege(e)ks - 3
Ge(ge)eks - 4
Ge(g)e(e)ks - 5
0
As I know the re module can match only patterns with no splits :
import re
print(re.findall('ge','Gegeeks'))
But I have give it a try in this code :
https://code.sololearn.com/cz0BVFzkuU4e/?ref=app
I don't know if this example will worm for you, but just see it .
Copyright to GeeksForGeeks .