Community Patterns

Community Library Entry

2

Regular Expression
Created·2017-02-10 19:33
Flavor·Python

r"
^([a-zA-Z0-9_\-]+(,?[a-zA-Z0-9_\-]+))*$
"
mg
Open regex in editor

Description

We had an issue where the "hosts=some_var" value could cause mass deployments if the wrong value was passed through. Specifically a comma with nothing surrounding it (i.e. "hosts=,"). This regex will allow us to fail when certain characters are present.

Submitted by anonymous