V
V
Vadim2017-09-15 08:52:56
Ruby on Rails
Vadim, 2017-09-15 08:52:56

How to make a regular expression to leave a hyphen or dash in a compound word?

you must leave the dash in the compound word. example:
something at the beginning of a miracle-yudo something at the end
something at the beginning of a miracle - yudo something at the end

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pavel Kornilov, 2017-09-15
@KorniloFF

/wonder\-yudo/im

R
Rsa97, 2017-09-15
@Rsa97

/[^\p{L}\s\d-]|\s-|-\s|^-|-$/im

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question