Look for a Character Set
Okay, you looked for the usernames
support anything. You looked for the swear words. The last thing you need to look out for is the timestamp. For this, remove the content that you’re currently having in the regular expression input field, and start with square brackets again, but this time don’t add a backslash in front of it because you want to use the square brackets as regular expression patterns.
With square brackets and regular expressions, you create character sets. So that means that your regular expression tries to match any character inside your regular expression. Looking at the timestamp, for example, we want to look for a dash (
And apart from this, we also look for numbers. So the
w token that we used before doesn’t work for us right now because we don’t have any letters in this. We only look for digits. And for this, you can use the
d token. Just like with the
w before, you need to put a backslash before the
d to not look for the literal character
d, but for the digit regex token.
Become a Member to join the conversation.