Is it just me or does your RegEx not work? I mean what you have is this:
/[A-z]/i
And it's basically saying does my word have at least one letter in it? So it if you have a semicolon attached to the end of your word, it will not be ignored. I think what you meant was someting like this:
/^[A-z]+$/i
That is if you wanted to ignore words with characters altogether.
Although what I thought when I read the task was that you were meant to rearrange the letters and keep the punctuation marks at the end, if any.
Uhm, I think what the task meant with leave the punctuation marks untouched was in the case of them being alone, so if you have ! you don't want to end up with !ay. My solution would transform hello! to ello!hay which may be wrong, you are right. They should have had stricter tests and a better description on CodeWars lol, they have no test case for a punctuation mark attached to a string.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Is it just me or does your RegEx not work? I mean what you have is this:
And it's basically saying does my word have at least one letter in it? So it if you have a semicolon attached to the end of your word, it will not be ignored. I think what you meant was someting like this:
That is if you wanted to ignore words with characters altogether.
Although what I thought when I read the task was that you were meant to rearrange the letters and keep the punctuation marks at the end, if any.
Uhm, I think what the task meant with
leave the punctuation marks untouched
was in the case of them being alone, so if you have!
you don't want to end up with!ay
. My solution would transformhello!
toello!hay
which may be wrong, you are right. They should have had stricter tests and a better description on CodeWars lol, they have no test case for a punctuation mark attached to a string.