Jul-16-2022, 10:39 PM
Hello everyone
I am looking for a way to take out numbers attached to concat string in paragraphs.
Before:
For example Paragraph:
1
It was 1their..some text, some text
2
This is one thing 2God....some text, some text
3
For 3He is.....some text, some text
150
5The people of....some text, some text
151
etc some text, some text
After:
For example Paragraph:
1
It was their..some text, some text
2
This is one thing God....some text, some text
3
For He is.....some text, some text
150
The people of....some text, some text
151
etc
The following regex is what I currently have :
I am looking for a way to take out numbers attached to concat string in paragraphs.
Before:
For example Paragraph:
1
It was 1their..some text, some text
2
This is one thing 2God....some text, some text
3
For 3He is.....some text, some text
150
5The people of....some text, some text
151
etc some text, some text
After:
For example Paragraph:
1
It was their..some text, some text
2
This is one thing God....some text, some text
3
For He is.....some text, some text
150
The people of....some text, some text
151
etc
The following regex is what I currently have :
re.sub('(?<=[ \t])?\d+\S\S+\S*','',txt)and replaces the whole string instead of leaving only the words. How can I fix this task? Thanks