Disclosure: Code not my own just edited from internet and added Regex function.
I want to find numbers in text and replace it with 'number' tag using Regex and the following code does it. I use tkinter to get text from user.
from tkinter import *
root=Tk()
def Reg_ex():
inputValue=textBox.get("1.0","end-1c")
A = re.sub("\d+", '<number>',inputValue)
print(A)
textBox=Text(root, height=40, width=50)
textBox.pack()
buttonCommit=Button(root, height=1, width=10, text="Reg_number",
command= Reg_ex)
buttonCommit.pack()
mainloop()
Obstacle: How to write the print output back into the text box for user to see.
Currently it prints in terminal but I want the output returned to text area for user to see it with original text replaced with reg_ex processed text.
Please Help!
Text. first half for your input text and second half for your output text. Then you can usetext.insert("END", value)to insert your input text into output one as your required format