I'm trying to use this regular expressions in Go lang:
~((?<=^[^\s])|(?<=\s[^\s]))\s(?=[^\s](\s|$))~
{(c|d|e|i|l|n|o|p|r|t|z)\1+}
{( |a|b|d|[f-h]|i|[j-k]|m|q|s|[u-y])\1+}
{(c|d|e|i|l|n|o|p|r|t|z)\1+}
{( |a|b|[f-h]|i|[j-k]|m|q|s|[u-y])\1+}
{(si|sa|za|ja|to)\1+}
and in everyone of those i get this error:
panic: regexp: Compile(
~((?<=^[^\s])|(?<=\s[^\s]))\s(?=[^\s](\s|$))~
): error parsing regexp: invalid or unsupported Perl syntax:(?<
Maybe there is a trick know for someone? :/ or is it impossible to use them?
If no lookbehinds supported, use a workaround like this:
((^|\s)\S)(\s)(?=\S(\s|$))
where:
Capture group 1 contains what's to be written back in place of the
lookbehind.
Capture group 3 is the actual whitespace in question.
It's in a capture group just to separate it from the entire match.
Summary: Group 1 + Group 3 = entire match.
Expanded:
# ( # (1 start)
# (?<= ^ [^\s] )
# | (?<= \s [^\s] )
# ) # (1 end)
( # (1 start)
( ^ | \s ) # (2)
\S
) # (1 end)
( \s ) # (3)
(?=
\S
( \s | $ ) # (4)
)