All,

 

Below I am just providing the example of what I want to achieve, not the
original strings that I will be using the regular expression against.

 

The original strings could have:

 

"Hello world"

"hello  World everyone"

"hello everyone"

"hello   world and friends"

 

I have a string which is "hello world" which I want to identify by using
regular expression how many times:

*       "hello" occurs on its own.
*       "Hello world" occurs in the list of strings regardless of the number
of white spaces.

 

Splitting the string into an array ['hello', 'world'] and then re-joining it
together and using a loop to move through the strings does not provide the
information I want. So I was wondering if this is possible via regular
expressions matching?

 

Modifying the original string is one option. But I was wondering if this
could be done?

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to