It is good to see a nice small piece of code which we can run. Thank
you.
So there are a number of things to comment about in the code below;
comments inline under the relevant piece of code (we prefer the "inline
reply" style here, it reads like a conversation):
On 01Oct2020 15:15, Raju wrot
import re
import os
import sys
#word = "7 the world" # 7 The world
#word = "Brian'S" # Brian's
#word = "O'biran"# O'Brian
#word = "Stoke-On-Trent" # Stoke-on-Trent; here i need to lower the case of
middle word(i.e -On-)
def wordpattern(word):
output = ''
if re.match("^\d+|w*$",word):
On 01Oct2020 12:41, Raju wrote:
>I want to change the case on input string i was able to match using
>python regex but couldn't find the way to change the case.
>
>For example string:
>Input: 7Section Hello Jim
>output: 7Section hello Jim
>
>I was doing if statment with regex
>
>if re.match("(\d+
Hello Everyone,
I want to change the case on input string i was able to match using python
regex but couldn't find the way to change the case.
For example string:
Input: 7Section Hello Jim
output: 7Section hello Jim
I was doing if statment with regex
if re.match("(\d+\w* )(Hello)( \w+)",stri