re: Daily Challenge #103 - Simple Symbols VIEW POST

FULL DISCUSSION
 

I've never been the best with Regex, but here's a possible attempt:

JavaScript

const acceptableSequence = str => !/(?<!\+)\w|\w(?!\+)/.test(str);

EDIT: Misread the requirements, don't need to account for end and beginning of line characters as exceptions.

 

\w generally includes the underscore, which is why I used the explicit character class.

 

That's a good point. I figured I'd use \w since nothing in the challenge indicated that the characters need be only alphabetical, but obviously you could just as easily sub in [a-zA-Z] or whatever fits the use case.

I interpreted “The string will be composed of + and = symbols with several characters between them.” as only +, = and letters. 😀

That definitely makes the most sense, given the examples. I really appreciate you reaching out to clarify - definitely want to make sure I'm accurately hitting objectives.

I'm just assuming either, but at least this is turning into a good lesson on how requirements get confused between whoever plans them and developers 😉

code of conduct - report abuse