Re: Ask for help on using re

2021-08-07 Thread Jach Feng
jak 在 2021年8月6日 星期五下午4:10:05 [UTC+8] 的信中寫道: > Il 05/08/2021 11:40, Jach Feng ha scritto: > > I want to distinguish between numbers with/without a dot attached: > > > text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' > re.compile(r'ch \d{1,}[.]').findall(text) > > ['ch 1.', 'ch 23.']

Re: Ask for help on using re

2021-08-07 Thread jak
Il 07/08/2021 11:18, jak ha scritto: Il 07/08/2021 04:23, Jach Feng ha scritto: jak 在 2021年8月6日 星期五下午4:10:05 [UTC+8] 的信中寫道: Il 05/08/2021 11:40, Jach Feng ha scritto: I want to distinguish between numbers with/without a dot attached: text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' re.compi

Re: Ask for help on using re

2021-08-07 Thread jak
Il 07/08/2021 04:23, Jach Feng ha scritto: jak 在 2021年8月6日 星期五下午4:10:05 [UTC+8] 的信中寫道: Il 05/08/2021 11:40, Jach Feng ha scritto: I want to distinguish between numbers with/without a dot attached: text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' re.compile(r'ch \d{1,}[.]').findall(text) ['c

Re: Ask for help on using re

2021-08-06 Thread jak
Il 06/08/2021 12:57, Jach Feng ha scritto: jak 在 2021年8月6日 星期五下午4:10:05 [UTC+8] 的信中寫道: Il 05/08/2021 11:40, Jach Feng ha scritto: I want to distinguish between numbers with/without a dot attached: text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' re.compile(r'ch \d{1,}[.]').findall(text) ['c

Re: Ask for help on using re

2021-08-06 Thread Jon Ribbens via Python-list
On 2021-08-06, jak wrote: > Il 06/08/2021 16:17, jak ha scritto: >> Il 06/08/2021 12:57, Jach Feng ha scritto: >>> That's an interest solution! Where the '|' operator in re.compile() >>> was documented? >> >> I honestly can't tell you, I've been using it for over 30 years. In any >> case you can

Re: Ask for help on using re

2021-08-06 Thread Jach Feng
jak 在 2021年8月6日 星期五下午4:10:05 [UTC+8] 的信中寫道: > Il 05/08/2021 11:40, Jach Feng ha scritto: > > I want to distinguish between numbers with/without a dot attached: > > > text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' > re.compile(r'ch \d{1,}[.]').findall(text) > > ['ch 1.', 'ch 23.']

Re: Ask for help on using re

2021-08-06 Thread jak
Il 06/08/2021 16:17, jak ha scritto: Il 06/08/2021 12:57, Jach Feng ha scritto: jak 在 2021年8月6日 星期五下午4:10:05 [UTC+8] 的信中寫道: Il 05/08/2021 11:40, Jach Feng ha scritto: I want to distinguish between numbers with/without a dot attached: text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' re.compi

Re: Ask for help on using re

2021-08-06 Thread Jach Feng
ast 在 2021年8月5日 星期四下午11:29:15 [UTC+8] 的信中寫道: > Le 05/08/2021 à 17:11, ast a écrit : > > Le 05/08/2021 à 11:40, Jach Feng a écrit : > >> I want to distinguish between numbers with/without a dot attached: > >> > > text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' > > re.compile(r'ch \d{1,

Re: Ask for help on using re

2021-08-06 Thread jak
Il 05/08/2021 11:40, Jach Feng ha scritto: I want to distinguish between numbers with/without a dot attached: text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' re.compile(r'ch \d{1,}[.]').findall(text) ['ch 1.', 'ch 23.'] re.compile(r'ch \d{1,}[^.]').findall(text) ['ch 23', 'ch 4 ', 'ch 56 '

Re: Ask for help on using re

2021-08-06 Thread ast
Le 06/08/2021 à 02:57, Jach Feng a écrit : ast 在 2021年8月5日 星期四下午11:29:15 [UTC+8] 的信中寫道: Le 05/08/2021 à 17:11, ast a écrit : Le 05/08/2021 à 11:40, Jach Feng a écrit : import regex # regex is more powerful that re text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' regex.findall(r'ch \d++(?!

Re: Ask for help on using re

2021-08-05 Thread ast
Le 05/08/2021 à 17:11, ast a écrit : Le 05/08/2021 à 11:40, Jach Feng a écrit : I want to distinguish between numbers with/without a dot attached: text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' re.compile(r'ch \d{1,}[.]').findall(text) ['ch 1.', 'ch 23.'] re.compile(r'ch \d{1,}[^.]').find

Re: Ask for help on using re

2021-08-05 Thread ast
Le 05/08/2021 à 17:11, ast a écrit : Le 05/08/2021 à 11:40, Jach Feng a écrit : I want to distinguish between numbers with/without a dot attached: text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' re.compile(r'ch \d{1,}[.]').findall(text) ['ch 1.', 'ch 23.'] re.compile(r'ch \d{1,}[^.]').find

Re: Ask for help on using re

2021-08-05 Thread Peter Pearson
On Thu, 5 Aug 2021 02:40:30 -0700 (PDT), Jach Feng wrote: I want to distinguish between numbers with/without a dot attached: >>> text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' >>> re.compile(r'ch \d{1,}[.]').findall(text) ['ch 1.', 'ch 23.'] >>> re.compile(r'ch \d{1,}[^.]').findall(tex

Re: Ask for help on using re

2021-08-05 Thread ast
Le 05/08/2021 à 11:40, Jach Feng a écrit : I want to distinguish between numbers with/without a dot attached: text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' re.compile(r'ch \d{1,}[.]').findall(text) ['ch 1.', 'ch 23.'] re.compile(r'ch \d{1,}[^.]').findall(text) ['ch 23', 'ch 4 ', 'ch 56 '

Re: Ask for help on using re

2021-08-05 Thread Neil
Jach Feng wrote: > I want to distinguish between numbers with/without a dot attached: > text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' re.compile(r'ch \d{1,}[.]').findall(text) > ['ch 1.', 'ch 23.'] re.compile(r'ch \d{1,}[^.]').findall(text) > ['ch 23', 'ch 4 ', 'ch 56 '] > > I

Re: Ask for help on using re

2021-08-05 Thread Jach Feng
Neil 在 2021年8月5日 星期四下午6:36:58 [UTC+8] 的信中寫道: > Jach Feng wrote: > > I want to distinguish between numbers with/without a dot attached: > > > text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' > re.compile(r'ch \d{1,}[.]').findall(text) > > ['ch 1.', 'ch 23.'] > re.compile(r'ch

Ask for help on using re

2021-08-05 Thread Jach Feng
I want to distinguish between numbers with/without a dot attached: >>> text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' >>> re.compile(r'ch \d{1,}[.]').findall(text) ['ch 1.', 'ch 23.'] >>> re.compile(r'ch \d{1,}[^.]').findall(text) ['ch 23', 'ch 4 ', 'ch 56 '] I can guess why the 'ch 23' appear