Given I have a string: Sebastian New York Canal st : Dinner at 5 c'clock.
Where:
between 2nd and 3rd group I have colon to separate those groups.
I wrote regular expression: https://regex101.com/r/iI6kN8/1
([A-Za-z0-9]+)?([A-Za-z0-9 ]+)?(:\ ([A-Za-z0-9'. ]+))
And it works when I have 3 groups:
but when I have:
Sebastian New York Canal st
or
Sebastian
Does not
Make the 3rd group optional:
([A-Za-z0-9]+)?([A-Za-z0-9 ]+)?(:\ ([A-Za-z0-9'. ]+))?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.