regex help
Posted: Sun May 10, 2009 3:24 pm
Alias: ^go(d)?(s|g)?\s?([A-Za-z' ]*?)$
Things I want it to match:
go
god
gos
gods
go one or more words after
god one or more words after
gos one or more words after
gods one or more words after
It matches all of that BUT it also matches"
goone or more words after
godone or more words after
gosone or more words after
godsone or more words after
The space needs to be optional, in case I am not putting the one or more words after, but if the words after it are in fact present, the space must be there.
Can anyone help there? I considered putting the space in the same capture group as the ([A-Za-z' ]*?) but the problem there, is that in the script of the alias I make a list call on the value of that capture group, which will not match if there is a space at the beginning of it.
Things I want it to match:
go
god
gos
gods
go one or more words after
god one or more words after
gos one or more words after
gods one or more words after
It matches all of that BUT it also matches"
goone or more words after
godone or more words after
gosone or more words after
godsone or more words after
The space needs to be optional, in case I am not putting the one or more words after, but if the words after it are in fact present, the space must be there.
Can anyone help there? I considered putting the space in the same capture group as the ([A-Za-z' ]*?) but the problem there, is that in the script of the alias I make a list call on the value of that capture group, which will not match if there is a space at the beginning of it.