Ok, so I’m trying to get the distance in a str (called bigstr), from a small other variable called smallstr until it ends.
For example:
bigstr = 'What are you saying?'
smallstr = 'you'
then
distance = 8
I’m trying to use re, but I’m a total noob with this library.
I am not sure if you need re for that, following should suffice:
Using split:
Using index:
Also you will notice that
distanceis 9 and not 8 because it counts spaces –'What are 'You can alsways use strip to remove any spaces, if that concerns you.
If you still want to use re: Then use search