Quote:
Javascript regex - how to match words after each colon in a string?
Bewaren a RegEx is about describing what to match and also what "no match" surroubs it.
your match starts after a colon and stops before the '-' or end if string.
You have to describe it all.
Nota: In French, "Jean-Yves" is a first compound name, since the "-" is also the end of match, you have to assume that your president can't have such name.
This avoid matching the space after 'Doe'
: ([\w]+( [\w]+)+)
Just a few interesting links to help building and debugging RegEx.
Here is a link to RegEx documentation:
perlre - perldoc.perl.org[
^]
Here is links to tools to help build RegEx and debug them:
.NET Regex Tester - Regex Storm[
^]
Expresso Regular Expression Tool[
^]
RegExr: Learn, Build, & Test RegEx[
^]
Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript[
^]
This one show you the RegEx as a nice graph which is really helpful to understand what is doing a RegEx:
Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[
^]
This site also show the Regex in a nice graph but can't test what match the RegEx:
Regexper[
^]