Thread: [Solved] Regex-pattern
View Single Post
 
Old 01-03-2025, 11:33 AM
gmaxey gmaxey is offline Windows 10 Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,601
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Batmat1,


Yes, correct. Omitted space after first comma was typo. Now, testing with your latest version: ", [A-Z][^, ]+( [^, ]+)*( [A-Z][^,]+)?,"
when applied to the following example returns the same matches as my last version: ",\s{A-Z][^,]*,"



Specifically the last instance ", John smith," is returned as a match. How could we prevent that? If you don't mind, can you explain what each part of your pattern is intended to perform?


For others following, with mine it is
1. "," match a comma
2. "\s" match a space
3. "[A-Z]" match a capital letter A to Z
4. "[^,]*" match any characters excluding a comma one or more times
5. "," match a comma
Attached Images
File Type: jpg Example.jpg (92.8 KB, 18 views)
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/