committed by
GitHub
parent
e1d31b9661
commit
2662a1c1e2
@ -11,11 +11,10 @@ Break the string into words and combine them adding `-` as a separator, using a
|
|||||||
from re import sub
|
from re import sub
|
||||||
|
|
||||||
def kebab(s):
|
def kebab(s):
|
||||||
return sub(
|
return '-'.join(
|
||||||
r"(\s|_|-)+","-",
|
sub(r"(\s|_|-)+"," ",
|
||||||
sub(
|
sub(r"[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+",
|
||||||
r"[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+",
|
lambda mo: ' ' + mo.group(0).lower(), s)).split())
|
||||||
lambda mo: mo.group(0).lower(), s))
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```py
|
```py
|
||||||
|
|||||||
Reference in New Issue
Block a user