Twitter DM Regex


Hey there! Is the regex for detecting DM’s in a message available for all?

I am working on an app where we want to detect that the outgoing message is a direct message (ie “d username message”) to alter the character count allowed. Also would like to know when the direct message isn’t formatted correctly (ie "d user?name message) causing the message to not send (instead of sending, but not as a dm).

Is this available anywhere? Thanks for the help!!


I am not familiar with anything comprehensive that would help you here as these are legacy SMS commands. I’d be curious to see whether the community can share solutions for you.