Skip to content

Inline Regexes

Although Pomsky on its own is very powerful, there might be situations where its syntax is not expressive enough. In these rare situations, Pomsky has an escape hatch: The regex keyword allows specifying an expression that is embedded in the output verbatim, without escaping:

regex 'hello|world?'

This emits the following regular expression:

hello|world?

For example, this is how you could use subroutines (which are not officially supported by Pomsky):

:octet(range '0'-'255') ('.' regex '\g<octet>'){3}

Note that Pomsky wraps a regex expression in a non-capturing group if it is followed by a repetition or surrounded by parentheses.

This concludes the language tour! Now you should be able to write and understand Pomsky expressions.

To chat about Pomsky or to get help, you can reach out on Discord.